I am trying to have my script be able to take in an arbitrary number of file names as command line arguments. In Unix, it is possible to use the ‘*’ key to represent any character. For example,
ls blah*.txt
will list every file with blah at the beginning and txt at the end.
I need something like this for my python script.
python myscript.py blah*.txt
Is this possible? and if it is, how can it be done?
Thats why you have
sys.argv(and dont forget toimport sys) It will return all yourblah*.txtas a list of filenames