Character and Text Representation
In this you will learn how to represent characters and text in Python.
We'll cover the following...
Character representation
We talked about encoding characters with ASCII and Unicode in the lesson on number and letter representation. Now, let’s see these encoding methods in Python. An English letter can easily be represented using 1 byte. In the code snippet below, we are finding the length of a UTF-8 encoded character that has the value A. Run to verify that it is indeed 1 byte.
Note: The function
encode
forces the use of a certain character encoding scheme like UTF-8.
Access this course and 1400+ top-rated courses and projects.