7

I am using Python 3.2.2

>>> s = 'hhh'
>>> print s
SyntaxError: invalid syntax
>>> print(s)
hhh
>>> print 2*2
SyntaxError: invalid syntax
>>> print(2*2)
4

Why do I have to use print("...") to print something? If I dno't it complains with 'SyntaxError'.

1
  • This damage to backwards compatibility was done on purpose and is most of the reason why it's going to take another 15 years or so for everyone to get around to python3. Python3 is just not compatible. Commented May 16, 2018 at 1:13

1 Answer 1

21

As of python 3.0, print is a function. See:

http://docs.python.org/release/3.0.1/whatsnew/3.0.html#print-is-a-function

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.