修复含转义反斜杠的损坏Unicode字符串(Python场景)
求助:损坏的Unicode字符串处理问题
我特意去翻了Stack Exchange上的几个相关问题,还浏览了不少类似的回答,但都没解决我的问题:
- 《python3 replacing double backslash with single backslash [duplicate]》
- 《Python Replace \ with \》
- 《Why can't Python's raw string literals end with a single backslash?》
- 《How do I unescape a unicode escaped string in python?》
我现在遇到的情况是:手里有一个损坏的Unicode字符串,里面同时包含转义反斜杠和转义字符,举个具体的例子,字符串形式大概是这样的:
my_str = '\xa5\xc0...'
目前完全找不到合适的方法来处理这个字符串,有没有大佬能给个可行的解决方案?
内容的提问来源于stack exchange,提问作者Zhenhir
相关产品推荐
相关产品推荐

