chr python unicode code example
Example 1: chr() python
The chr() method returns a string representing
a character whose Unicode code point is an integer.
print(chr(71), chr(101),
chr(101), chr(107),
chr(115), chr(32),
chr(102), chr(111),
chr(114),chr(32),
chr(71), chr(101),
chr(101), chr(107),
chr(115))
-> G e e k s f o r G e e k s
Example 2: python unicode point to utf8 string
import re
def makeNice(s):
return re.subn('(#U[0-9a-f]{4})', lambda cp: chr(int(cp.groups()[0][2:],16)), s) [0]
a = '-#U2605-#U79c1-'
print(a, makeNice(a))