Filenames glob to themselves. If you want to accept globs, I would just pass them all through glob. If one is just a filename, you'll get that filename back. I'd also use itertools to put it into one single list.
import itertools import glob filenames = list(itertools.chain.from_iterable([glob.glob(x) for x in sys.argv[1:]]))