Easy Python tutorials | Unicode in Python

Publié le: 27 juin 2026
sur la chaîne: EasyDataScience
26
0

In olde computer days, ASCII used 7 bits (128 unique values) enough in text representation. To solve the problem of far less representing all letters in the webpages, Unicode is an ongoing international standard to define the characters of all the world’s languages, plus symbols from mathematics and other fields. The latest version defines over 159,000 characters, each with a unique name and identification number.
The first 128 characters of Unicode are exactly the same as ASCII.
The Unicode Character Name Index page lists all the characters along with their coding and names in Unicode.

Python 3 strings are Unicode strings, not byte arrays.
A \u followed by four hex numbers2 specifies a character in one of Unicode’s 256 basic multilingual planes. The first two are the plane number (00 to FF), and the next two are the index of the character within the plane. Plane 00 is good old ASCII, and the character positions within that plane are the same as ASCII. For characters in the higher planes, we need more bits.
The Python escape sequence for these is \U followed by hex characters; For all characters, \N{ name } lets you specify it by its standard name. lists these.

The Python unicodedata module has functions that translate in both directions:
lookup()—Takes a case-insensitive name and returns a Unicode character
name()—Takes a Unicode character and returns an uppercase name


#python
#unicode
#easydatascience2508


Sur cette page du site, vous pouvez voir la vidéo en ligne Easy Python tutorials | Unicode in Python durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur EasyDataScience 27 juin 2026, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 26 fois et il a aimé 0 téléspectateurs. Bon visionnage!