把下面的unicode编码转换成汉字
unicode:
\\u5c0f\\ud84c\\uddc9\\u809d\\u4e32\\u4e32\\u9999
正确的汉字为:小𣇉肝串串香
下面是代码:
unicode_str = "\\u5c0f\\ud84c\\uddc9\\u809d\\u4e32\\u4e32\\u9999"
text = unicode_str.encode('utf-8', 'ignore').decode('unicode_escape')
print(text)把下面的unicode编码转换成汉字
unicode:
\\u5c0f\\ud84c\\uddc9\\u809d\\u4e32\\u4e32\\u9999
正确的汉字为:小𣇉肝串串香
下面是代码:
unicode_str = "\\u5c0f\\ud84c\\uddc9\\u809d\\u4e32\\u4e32\\u9999"
text = unicode_str.encode('utf-8', 'ignore').decode('unicode_escape')
print(text)可以用 cp1252代码集试一下:
output[name].to_csv(outfile, float_format = '%.5f',index = False,encoding = 'cp1252')
cp1252 编码是 ANSI/ASCII 的子集,因此可以使用 cp1252 编码生成 ANSI/ASCII 格式的 txt 文档。