Python 2 vs Python 3
Key differences and migration
Interview Relevant: Understanding legacy code
Python 2 vs Python 3
Python 3 is the present and future. Python 2 reached End of Life (EOL) in 2020.
Key Differences
- Print: Statement in Py2 (
print "Hi") vs Function in Py3 (print("Hi")). - Integer Division:
3/2 = 1in Py2 vs1.5in Py3. - Unicode: Strings are ASCII in Py2, Unicode in Py3 by default.