Python 代码库之unicode 编码与字符串之间相互转换
2019-08-11 本文已影响2人
iCloudEnd
Python 代码库之unicode 编码与字符串之间相互转换
chr(57344)
'\ue000'
ord('\ue000')
57344
U+xxxx 转为字符 方法一
def u2w(mstr):
t=mstr
t=t.replace('U+','\\u')
return json.loads(f'"{t}"')
U+xxxx 转为字符 方法二
def u2w(cstr):
return chr(int('0x'+cstr,16))