Newbie: Joining Lists
Matimus
mccredie at gmail.com
Thu May 17 11:53:10 EDT 2007
One: Not that I know of
Two: You could use list comprehension...
----------------------- CODE ----------------------
import os
import glob
patterns = ('.\\t*.py', '.\\*.c??', '.\\*.txt')
filenames = [glob.glob(pat) for pat in patterns]
# Or as a one liner...
filenames = [glob.glob(pat) for pat in ('.\\t*.py', '.\\*.c??', '.\
\*.txt')]
# Also, I don't think specifying the current directory is necessary.
So this should also work:
filenames = [glob.glob(pat) for pat in ('t*.py', '*.c??', '*.txt')]
More information about the Python-list
mailing list