When I try to use a print
statement in Python, it gives me this error:
>>> print \"Hello, World!\"
File \"\", line 1
Basically, since Python 3.x you need to use print
with parenthesis.
Python 2.x: print "Lord of the Rings"
Python 3.x: print("Lord of the Rings")
print
was a statement in 2.x, but it's a function in 3.x. Now, there are a number of good reasons for this.
>>> items = ['foo', 'bar', 'baz'] >>> print(*items, sep='+') foo+bar+baz