December 2019
Beginner
496 pages
15h 37m
English
Throughout the book, we have mentioned several differences between Python 3 and Python 2. The book uses Python 3, but we also want you to know how to recognize Python 2 code and make your code compatible with Python 2 if you want to. This appendix only talks about the Python 3 to 2 differences in the parts of Python that we have covered in this book.
With that in mind, here are some of the ways Python 2 is different from Python 3.
In Python 2, print is a special “keyword” instead of a function. That means instead of writing
print("Hello, World!")
you can write:
print "Hello, World!"
There are some other differences related to this. Instead of using the end argument to make output from the ...