Y
Hacker News
new
|
ask
|
show
|
jobs
by
ch0wn
4898 days ago
Without `from __future__ import print_function`, print doesn't work the same way in Py2k, though.
1 comments
mahmoudhossam
4898 days ago
In 2.7, it does.
link
buster
4898 days ago
Unfortunately not.. atleast not in my 2.7.3 prompt. Only with the __future__ import :(
link
jau
4897 days ago
In 2.6.6 also works.
link
ch0wn
4897 days ago
If you use print() in py2k, you're still using the print statement and group the argument in parentheses. It falls apart, if you try to use more than one argument, because it's interpreted as a tuple then.
Python3:
>>> print("hello", "world") hello world
Python2:
>>> print("hello", "world") ('hello', 'world')
link