-1

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
Kurt McKee
  • 1,410
  • 13
  • 17
Rijz
  • 1
  • 1
    See also http://python3porting.com/differences.html – Lennart Regebro Nov 15 '11 at 17:41
  • 2
    Exact duplicate of [Syntax error on print with Python 3](http://stackoverflow.com/questions/826948/syntax-error-on-print-with-python-3) Please search before you post a question. – Lennart Regebro Nov 15 '11 at 17:42
  • Possible duplicate of [Syntax error on print with Python 3](https://stackoverflow.com/questions/826948/syntax-error-on-print-with-python-3) – 17slim Jun 21 '18 at 19:40

2 Answers2

3

You're reading Python 2.x material. Find Python 3.x material and read that instead. The language has changed.

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358
0

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

Community
  • 1
  • 1
wilbbe01
  • 1,931
  • 1
  • 24
  • 38