2013-07-03 36 views

回答

0

与列表理解:

>>> [a for b in x for c in b for a in c] 
[u'reads_2.fq', u'README.txt'] 

或者,如果你正在使用Python 2.7(注意: compiler模块是过时,不提供在python 3):

>>> from compiler.ast import flatten 
>>> flatten(x) 
[u'reads_2.fq', u'README.txt'] 
0

你可以试试这个:

>>> y = [] 
>>> for a in x: 
...  if a: 
...   y.append(a[0][0]) 
... 
>>> y 
[u'reads_2.fq', u'README.txt'] 
相关问题