Search⌘ K
AI Features

Introduction to Unicode

Explore how Python 3 enhances string handling by making all strings Unicode, eliminating many encoding errors common in Python 2. Understand the benefits of Unicode for variable naming and text processing, and learn about tools like Unidecode to manage character encoding.

One of the major changes in Python 3 was the move to make all strings Unicode. Previously, there was a str type and a unicode type. For example:

Python
# Python 2
x = 'blah'
print (type(x))
y = u'blah'
print (type(y))

If we do the same thing in Python 3, you will note that it always returns a string type:

Python 3.5
# Python 3
x = 'blah'
print (type(x))
y = u'blah'
print (type(y) )

Testing unicode variable name in Python 2

Testing unicode variable name in

...