I\'m going through Google\'s Python exercises and I need to be able to do this from the command line:
python babynames.py --summaryfile baby*.html
Windows' command interpreter does not expand wildcards as UNIX shells do before passing them to the executed program or script.
python.exe -c "import sys; print sys.argv[1:]" *.txt
Result:
['*.txt']
Solution: Use the glob
module.
from glob import glob
from sys import argv
for filename in glob(argv[1]):
print filename