I am writing code in Python that I should run with the command line and when I call the script i should give some arguments that I would use in the code. What can I use to achieve that?
To run the script it would be something like this:
python myscript.py s1 s2 s4
where s1, s2 and s4 would be the arguments that I would use in my code.
Quick dirty way
(
sys.argv[0]is the name of the script)For more flexibility you can use the argparse module