PDA

View Full Version : Python Syntax Error



jeffymarts
June 19th, 2010, 04:53 PM
First off I'm going to apologize for making a post with a dumb question, secondly I'll also apologize for taking up your time. Ok, but here's the problem I'm encountering. When I try to issue a print command in Python I get an error message which states "SyntaxError: invalid syntax". Here is an example.


>>> the_world_is_flat = 1
>>> if the_world_is_flat:
print "Be careful not to fall off!"

SyntaxError: invalid syntax

Thank you for your time.

trent.josephsen
June 19th, 2010, 05:09 PM
Are you using Python 3? print is a function, not a statement, in Python 3.


print("Be careful not to fall off!")

jeffymarts
June 19th, 2010, 05:10 PM
I am using Python 3. Thanks for the insight.