How do you accept/parse command line arguments for a py file that has no class? Here is what I have inside my file test.py:
import sys
if __name__ == '__main__':
How do I get the arguments when the file is executed via command line? I call it via:
python test.py <arg1>
and obviously want the value of "arg1".
argv python. first link on Google is your answerargv? This is perfectly appropriate.python commad line argumentmost results on the first page point to the right answer, with examples