如何将'\u5de5'转换为'\u5de5'?

问题描述 投票:0回答:1

不同之处:

len('\\u5de5')
6
len('\u5de5')
1

如何编写一个函数将

\\u5de5
转换为
\u5de5

def con_str(arg):
    some_code_here
    return result

con_str('\\u5de5')
\u5de5
python character-encoding python-unicode
1个回答
-1
投票

您可以对不包括第一个元素的字符串进行切片,并使用 next 函数返回它:

   def con_str(arg):
    result = arg[0:]
    return result
© www.soinside.com 2019 - 2024. All rights reserved.