Using argv
Hi there,
I'm just delving into python and I'm a bit stuck with argv. I understand how to use it with the command line on my computer but how does it work exactly in Pythonista.
For example, this small script passes in the name of the script and three variables, first, second and third but how do I do that with Pythonista?
from sys import argv script, first, second, third = argv print "\n" print "The script is called:", script print "\n" print "Your first variable is:", first print "\n" print "Your second variable is:", second print "\n" print "Your third variable is:", third print "\n"
Any help appreciated.
Kind Regards
Ah, I figured it out.
- kevinspacely
This post is deleted!last edited by
- kevinspacely
@kevinspacely script is ok for Python 2
Put as 1st line
#!python2
And test so
There is also a 2to3 button under the wrench icon. Funny because there are exactly 223 days until Python 2 end of life!!