Poursuite de http://qiita.com/items/a8a46173c53830f7d465
>>> fa = ["a", "b", None, "c", "e", None, None, None, "d"]
>>> [i for i in fa if i]
['a', 'b', 'c', 'e', 'd']
>>> #Sous le répertoire de travail`.eml`Obtenez une liste de fichiers avec l'extension
>>> for root, dirs, files in os.walk(os.path.abspath(".")):
... buff += [os.path.join(root, fname) for fname in files if os.path.splitext(os.path.join(root,fname))[1] == '.eml']
...
>>> buff
['/path/to/1.eml', '/path/to/2.eml']
Recommended Posts