在Python中将u"string"转换为"string"而不改变编码

mar*_*tin 5 python unicode

我有以下内容:

u'\x96'
Run Code Online (Sandbox Code Playgroud)

我想将其转换为以下内容:

'\x96'
Run Code Online (Sandbox Code Playgroud)

有没有办法做到这一点?str()不起作用,使用.encode(...)时更改编码.我的主要目标是能够获得以下结果,因此任何到达那里的快捷方式也将被接受:

>>> '\x96'.decode("cp1252")
u'\u2013'
Run Code Online (Sandbox Code Playgroud)

换句话说,我有u'\x96',我想要u'\u2013'.任何帮助,将不胜感激.

我正在使用Python 2.7.

mou*_*uad 6

u'\x96'.encode('raw_unicode_escape').decode("cp1252")
Run Code Online (Sandbox Code Playgroud)