In python3 there is absolutely no problem, however in python2 there was a print
statement which precludes you from using it as an identifier, including a method name.
It seems like you have python2 on Ubuntu and python3 on Windows, hence the difference.
If you want to avoid the print
statement in python2 add:
from __future__ import print_function
At the top of your file and you should obtain python3's print
function, thus allowing you to define a method called print
, (see this documentation).
Also note that without the __future__
import and in python3 this line:
print('x:', x)
Outputs:
x: <value for x>
However in python2 without the special import you get:
('x:', <value for x>)
Because the (...)
does not specify the arguments to the function but is interpreted as a tuple to be printed by the statement.