简体   繁体   English

python utf-8编码处理'\\'

[英]python utf-8 coding handling '\'

I'm trying to print a string in utf-8 form,the ideal result is as follow : 我正在尝试以utf-8格式打印字符串,理想的结果如下:

在此处输入图片说明

在此处输入图片说明

and it actually works that way if I mean it. 如果我是认真的,它实际上就是这样。

However,when i try to print another string just seems like it,the result is 但是,当我尝试打印另一个字符串时,结果是

在此处输入图片说明

and i have found out what is wrong,but i don't know how to fix it. 而且我发现了问题所在,但是我不知道如何解决。 The problem is the string i am trying to print is: 问题是我要打印的字符串是:

在此处输入图片说明

i try to remove one of the '\\',but it means one '\\' when there is actually '\\\\',yet the difference is made. 我尝试删除一个'\\',但实际上是一个'\\\\'时意味着一个'\\',但有所不同。 can someone save me from this puzzle? 有人可以把我从这个难题中解救出来吗? Thanks a lot! 非常感谢!

Try using "\\\\xe6\\\\x90\\\\x9c".decode('string_escape') 尝试使用"\\\\xe6\\\\x90\\\\x9c".decode('string_escape')

例

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM