Using argparse in conjunction with sys.argv in Python
-
29-10-2019 - |
Question
I currently have a script, which uses file globbing via the sys.argv
variable like this:
if len(sys.argv) > 1:
for filename in sys.argv[1:]:
This works great for processing a bunch of files; however, I would like to use this with the argparse
module as well. So, I would like my program to be able to handle something like the following:
foo@bar:~$ myScript.py --filter=xyz *.avi
Has anyone tried to do this, or have some pointers on how to proceed?
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow