python3-cookbook
:
>>> import unicodedata
>>> import sys
>>> cmb_chrs = dict.fromkeys(c for c in range(sys.maxunicode)
... if unicodedata.combining(chr(c)))
>>> a = "pt is awesome\n"
>>> b = unicodedata.normalize("NFD", a)
>>> b
"pt is awesome\n"
>>> b.translate(cmb_chrs)
"python is awesome\n"
>>>
cmb_chrs
the value corresponding to each key is None
, so why can you get the string python is awesome\ n
after executing b.translate (cmb_chrs)
?