【发布时间】:2018-02-21 14:16:54
【问题描述】:
我检查了this solution,但它在 python3 中不起作用。
我有一个这样的转义字符串:str = "Hello\\nWorld",我想获得相同的未转义字符串:str_out = Hello\nWorld
我试过这个没有成功:AttributeError: 'str' object has no attribute 'decode'
这里是我的示例代码:
str = "Hello\\nWorld"
str.decode('unicode_escape')
【问题讨论】: