I’m running a python program compiled on windows which receives files as input but have problems when I’m passing file names.
foo.py:
def main():
args = sys.argv[1:]
for i in args:
print i
But when I compile and call it from the command line
\python foo.py *.html
It directly gives me the result of *.html which I hope to see a list of matching strings.
Can anyone hep plz:)
You need to use something called
glob. For a single filename what you are doing is fine. But if you want to loop through a file pattern, then useglob. It’s basically a regex for filesSo in your case –