views:

74

answers:

2

I use python to create my project settings setup, but I need help. I tried reading but can't find info to do this:

$python myfile.py var1 var2 var3

In my Python file I need to use all vars that are input.

+5  A: 

Python tutorial explains it:

import sys

print(sys.argv)
SilentGhost
sys.args is not defined - perhaps you meant sys.argv?
Ryan Mentley
fixed the typo.
SilentGhost
Tanks, but now i need to take my var1 in use? what happen here.. :)
NeoNmaN
Dooh, got it ( sys.argv[1] ) :D
NeoNmaN
+3  A: 
import sys

sys.argv[1:]

will give you a list of arguments (not including the name of the python file)

Ryan Mentley