import sys
print sys.argv[1]
hi,
this may seem very basic but I can't get Python to read in anything from the command line. thats the code above and what I type is:
myfile.py helloworld
and what i get back is:
IndexError: list index out of range
It seemed to work once for me but won't work any more, and I've tried uninstalling and reinstalling Python and it still doesnt work.
So my question is, am I doing anything wrong? or have I just broken Python?
Thanks for any help
Using: Windows 7 Python 2.7.2
print sys.argv
? And does it work, when calling the file viapython.exe myfile.py helloworld
? – Buckshotpython foo.py a
works butfoo.py a
doesn't,) scroll past the first answer. – Chokefull