I am a beginner in Python. I am using the latest version of Python 3.2 on Windows 7. I found that print
, count
, raw_input("")
and many others are showing errors. Here's an example of the error:
>>> print "Any body to help"
File "<stdin>"开发者_运维百科, line 1
print "Any body to help"
^
SyntaxError: invalid syntax
You're reading Python 2.x material. Find Python 3.x material and read that instead. The language has changed.
Yes, the syntax was changed. Seeing as a lot of the code out there still is not 3.x, I'm guessing you may or may not actually be able to find the equivalent code to what you're looking at in 3.x. So to answer your specific question though you should type prints as follows in python 3.x.
print("Any body to help")
Hope this helps.
Edit: This should help clear up your raw_input as well. Another SO Question
精彩评论