how do I .decode('string-escape') in Python3?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have some escaped strings that need to be unescaped. I'd like to do this in Python. For example, in python2.7 I can do this: >>> "\123omething special".decode('string-escape') 'Something special' >>> How do I do it in Python3? This doesn't work: >>> b"\123omething special".decode('string-escape') Traceback (most recent call last): File " ", line 1, in LookupError: unknown encoding: string-escape >>> My goal is to be abel to take a string like this: s\000u\000p\000p\000o\000r\000t\000@\000p\000s\000i\000l\000o\000c\000.\000c\000o\000m\000