Unraveling Unicode

So far, you have been using strings that work with English text (and some Western languages, like French and German). But what if you need to use Russian or Japanese? Python 2.0 introduced a special string type called Unicode strings that let you manipulate strings in any language or alphabet.

Unicode strings work mostly the same way as regular strings. Here are a few of their unique features:

• Unicode strings in Python are specified with a lowercase u.

• In most installations of Python, a four-digit hexadecimal number represents each Unicode character.

Regular (ASCII) characters use a two-digit hexadecimal number.

Was this article helpful?

0 0

Post a comment