jeudi 3 avril 2014

Python 'print' statement and arguments


Vote count:

0




Good afternoon!


I'm an experienced C++ developer, but am just getting my feet wet with Python for a project at work. I'm having some basic problems and Google has been less than helpful. I suspect something about my environment is funny, but I have no clue how to diagnose it. I wrote a simple script that merely prints an argument to the screen, but I am getting an error when running it (python args.py):



Syntax Error: invalid syntax
File "args.py", line 4
print arg0


For reference, there is a carrot underneath the 0 of arg0. The script in question:



import sys

firstArg = sys.argv[0]
print firstArg


I'm sure this is something really dumb, but Python is such a foreign thing, coming from C++. Thanks in advance!



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire