简体   繁体   English

Python Unicode 字符串在文件中存储为 '\蒸\汽\地',如何将其转换回 Unicode?

[英]Python Unicode string stored as '\u84b8\u6c7d\u5730' in file, how to convert it back to Unicode?

Some Unicode data is stored in file as '\蒸\汽\地' without any encoding.一些 Unicode 数据以 '\蒸\汽\地' 的形式存储在文件中,没有任何编码。

Is there a way to covert them back in Python?有没有办法将它们转换回 Python 中?

>>> print '\u84b8\u6c7d\u5730'.decode('unicode-escape')
蒸汽地

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在python中将字符串'\\ u05d9 \\ u05d7 \\ u05e4 \\ u05d9 \\ u05dd'转换为其Unicode字符 - convert a String '\u05d9\u05d7\u05e4\u05d9\u05dd' to its unicode character in python 如何在Python中将u'\\\\ u4f60 \\\\ u4f60'这样的unicode字符串转换为u'\\ u4f60 \\ u4f60'? - How to convert unicode string like u'\\u4f60\\u4f60' to u'\u4f60\u4f60' in Python? 如何在 Python 中解码以“%u”(百分号 + u)开头的 unicode 字符串 - How to decode the unicode string starting with “%u” (percent symbol + u) in Python 3 如何在python中更正一个Unicode字符串,如“ \\ u8bf8 \\ u845b \\ u4eae”? - How to correct one unicode string like “\u8bf8\u845b\u4eae” in python? 如何在python中的代码点上拆分unicode字符串? (例如\\ u00B7或\\ u2022)? - How do I split a unicode string on code points in python? (eg. \u00B7 or \u2022)? Python将#U0048样式Unicode转换为普通字符串 - Python convert #U0048 style unicode to normal string python将unicode代码值转换为字符串,不带'\\u\u0026#39; - python convert unicode code value to string, without '\u' python unicode 用空字符串替换反斜杠 u - python unicode replace backslash u with an empty string Python - unicode字符串中的ASCII编码字符串; 如何删除'你'? - Python - ASCII encoding string in the unicode string; how to remove that 'u'? 如何在python 3中从unicode中打印正确的字符,如“\\\“借\\\”东风”? - how to print the right character from unicode like "\\u201c借\\u201d东风" in python 3?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM