更新时间:2023-11-07 15:44:34
您可以使用 unicode-escape 编解码器可消除双反斜杠并有效地使用字符串.
You can use the unicode-escape codec to get rid of the doubled-backslashes and use the string effectively.
假设title
是str
,则需要先对字符串进行编码,然后再解码回unicode(str
).
Assuming that title
is a str
, you will need to encode the string first before decoding back to unicode(str
).
>>> t = title.encode('utf-8').decode('unicode-escape')
>>> t
'ისრაელი == იერუსალიმი'
如果title
是bytes
实例,则可以直接解码:
If title
is a bytes
instance you can decode directly:
>>> t = title.decode('unicode-escape')
>>> t
'ისრაელი == იერუსალიმი'