Search⌘ K
AI Features

Character and Text Representation

Explore character encoding methods such as ASCII and Unicode in Python, and learn to manipulate strings using operators, indexing, and slicing. This lesson also includes coding challenges to practice decoding and string manipulation.

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 ...