我有一个嵌套列表分发:重排列表的列表,以便更早列表在后面列出
[ [ 'col1',
'col2',
'col3',
'col4',
'some comment',
'another comment'],
[ 'col1',
'col2',
'col3',
'col4',
'someone said something',
'a comment here',
'more blah blah']
]
我正在寻找一个更优雅和Python的方式直到结束:
[ [ 'col1', 'col2', 'col3', 'col4', 'some comment'],
[ 'col1', 'col2', 'col3', 'col4', 'another comment'] ],
[ 'col1', 'col2', 'col3', 'col4', 'someone said something'],
[ 'col1', 'col2', 'col3', 'col4', 'a comment here']
[ 'col1', 'col2', 'col3', 'col4', 'more blah blah']
比我到现在为止所做的还要多。
- 幸运的是,我的所有内部列表具有相同的4串(又名
col1
,col2
, 等)。 - 我有很多内部列表(不只是2)。
- 每个内部列表中的前4个字符串后面至少有一个字符串;往往有很多。