Example:
>>> print u'this sign is \N{VULGAR FRACTION ONE HALF} off'.encode('utf8')
this sign is ½ off
You can tell the name of any given character by using the unicodedata module
>>> import unicodedata
>>> unicodedata.name(u'\xbd')
'VULGAR FRACTION ONE HALF'
The name of the famous snowman character is simply enough 'SNOWMAN.
>>> unicodedata.name(unichr(9731))
'SNOWMAN'
So you can represent this character in python simply by u'\N{SNOWMAN}'
>>> import unicodedata
>>> unicodedata.name(u'\xbd')
'VULGAR FRACTION ONE HALF'
The name of the famous snowman character is simply enough 'SNOWMAN.
>>> unicodedata.name(unichr(9731))
'SNOWMAN'
So you can represent this character in python simply by u'\N{SNOWMAN}'
No comments:
Post a Comment