Feature |
Python 2 |
Python 3 |
Print Syntax |
print "Hello" |
print("Hello") |
Unicode Handling |
Uses ASCII by default |
Uses Unicode by default |
xrange() Function |
Available |
Replaced with range() function |
Exception Handling |
Uses except Exception, e |
Uses except Exception as e |
Syntax |
Less consistent and more verbose syntax |
More consistent and streamlined syntax |
Library Compatibility |
Some libraries are not compatible with Python 3 |
Improved library support for Python 3 |
Unicode Support |
Limited |
Improved and enhanced |
String Handling |
ASCII by default |
Unicode (UTF-8) by default |
Source Code Encoding |
No default source code encoding |
Source code encoded in UTF-8 by default |