The ucnhash Module

(Implementation, 2.0 only) The ucnhash module is an implementation module, which provides a name to character code mapping for Unicode string literals. If this module is present, you can use N{} escapes to map Unicode character names to codes, as shown in Example 8-4.

Example 8-4. Using the ucnhash Module

File: ucnhash-example-1.py

# Python imports this module automatically, when it sees
# the first N{} escape
# import ucnhash

print repr(u"N{FROWN}")
print repr(u"N{SMILE}")
print repr(u"N{SKULL AND CROSSBONES}")

u'u2322'
u'u2323'
u'u2620'

Core Modules

More Standard Modules

Threads and Processes

Data Representation

File Formats

Mail and News Message Processing

Network Protocols

Internationalization

Multimedia Modules

Data Storage

Tools and Utilities

Platform-Specific Modules

Implementation Support Modules

Other Modules



Python Standard Library
Python Standard Library (Nutshell Handbooks) with
ISBN: 0596000960
EAN: 2147483647
Year: 2000
Pages: 252
Authors: Fredrik Lundh

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net