I have unicode-like strings but with slash escaped. For example, '\\u000D'
. I need to decode them as normal strings. The above example should be convert to '\r'
which '\u000D'
corresponds to.
Use the unicode-escape
codec.
>>> import codecs
>>> codecs.decode('\\u000D', 'unicode-escape')
'\r'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With