Issue
I use python to create my project settings setup, but I need help getting the command line arguments.
I tried this on the terminal:
$python myfile.py var1 var2 var3
In my Python file, I want to use all variables that are input.
Solution
import sys
print(sys.argv)
More specifically, if you run python example.py one two three
:
>>> import sys
>>> print(sys.argv)
['example.py', 'one', 'two', 'three']
Answered By – SilentGhost
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0