1. Home
  2. Computing & Technology
  3. Python

Beginning Python: Python Encodings

From , former About.com Guide

2 of 7

How to Work with Unicode in Python

The mapping of "0x40" for the letter "g" is called an encoding. The value is encoded as the letter. Depending on the encoding, "0x40" could be the letter "g" (as in many North American and European encodings) or the Bangladeshi "ل" or the Georgian "პ".

For multilingual encoding, Python uses Unicode. Unicode is a system that provides a unique number for every character of a language, no matter what the language.

In order to print a Unicode character, Python requires you to do two things:

  1. Define the character string to be printed as Unicode, and
  2. Declare the type of encoding you would like Python to use in the output.
The next couple pages of this tutorial will look at these two requirements in-depth. We will then look at how to convert a standard string into Unicode.

Explore Python
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Python
  4. Beginning Python
  5. How to Work with Unicode in Python

©2009 About.com, a part of The New York Times Company.

All rights reserved.