I know that the print
is a function in Python 3 and a statement in Python 2. Found it here
I tested local and online interpreters with below code
In Python 3:
print('test')
- working fine
print 'test'
- throwing error
In Python 2:
print('test')
- working fine
print 'test'
- working fine
My question is that if the print is a statement and not a function in Python 2, isn't it supposed to throw a syntax error when we use print
function?
Why is it still working in Python 2 when we use print
function?