To get the 3.0 print function we do the following in Python 2.6:
from __future__ import print_function
But to use the function we invoke pr
In Python 3, the keyword print
has been changed from calling a statement to calling a function.
So instead of saying print value
you now need to say print(value)
, or you'll get a SyntaxError
.
By doing the import
, this change is effected in Python 2, too, so you can write programs using the same syntax as Python 3 (at least as far as print
is concerned).