I want this result:
u'\ue8fc\x82'
But it always gives me:
u'\\ue8fc\\u0082'
Sample 1:
>>> a='\ue8fc\u0082'
>>> a
'\\ue8fc\\u0082'
>>> print a
\ue8fc\u0082
>>> unicode(a)
u'\\ue8fc\\u0082'
>>> unicode(a).replace('\\\\','\\')
u'\\ue8fc\\u0082'
>>> repr(unicode(a).replace('\\\\','\\'))
"u'\\\\ue8fc\\\\u0082'"
>>> repr(unicode(b).replace('\\','?'))
"u'?ue8fc?u0082'"
>>> repr(unicode(b).replace('\\','?').replace('?','\\'))
"u'\\\\ue8fc\\\\u0082'"
Sample 2:
>>> u'\ue8fc\u0082'
u'\ue8fc\x82'
>>> repr(u'\ue8fc\u0082')
"u'\\ue8fc\\x82'"
Why I need this:
I wanna turn
'%ue8fc%u0082'
into
'\ue8fc\u0082'