Wednesday, January 9, 2008

Print the Copiright Sign in Python

To print the Copiright Sign with Python we need to use the Unicode string literal format.

A quoted string with a "u" or a "U" just before the leading quote is an Unicode string.
The escape sequence "\N{name}" prints the character specified by "name", where "name" is a standard Unicode name, a s listed in www.unicode.org/charts/

Example:

print u'\N{Copyright Sign}'

prints the Copyright sign.

0 commenti: