python - Converting \x escaped string to UTF-8 -
this question has answer here:
- evaluating escape sequences in perl 3 answers
how can convert string looks '\xd0\xbf\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82'
readable either perl or python?
in python 2.7
>>> print '\xd0\xbf\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82' привет >>> print '\\xd0\\xbf\\xd1\\x80\\xd0\\xb8\\xd0\\xb2\\xd0\\xb5\\xd1\\x82'.decode('string-escape') привет
Comments
Post a Comment