Size: 705
Comment:
|
Size: 653
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 14: | Line 14: |
||print "%03d" % 7 || print("{:03d}".format(7)) || |
Behaviour of print
The behaviour of print differs in Python 2 and in Python 3.
In version 7.2, SageMath is using the Python 2 syntax for print. It may soon switch to the Python 3 syntax, where print is a function.
To convert print from Python 2 to Python 3, you basically need to add parentheses, and write print("x") instead of print "x". |
Here is a conversion table to help you adapt your code:
Python 2 |
Python 3 |
print a |
print(a) |
print a, b, c |
print(a, b, c) |
print x, |
print(x, end=" ") |
print >>sys.stderr, x |
print(x, file=sys.stderr) |