![](/img/trans.png)
[英]How can you print a string using raw_unicode_escape encoding in python 3?
[英]How can I print the raw unicode in python?
我是Python新手,所以可能我表达得不好......
我得到一个字符串'\\xb9\\xfe'
我希望它以这种非常时尚的方式打印'\\xb9\\xfe'
,而不是转换为汉字'哈'
。
什么是正确的方法呢?
改用原始字符串文字:
r'\xb9\xfe'
或打印字符串的repr()
输出:
print(repr('\xb9\xfe'))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.