I have a string like s1 = "\xed\xf3\xb4\x90"
.
>>> x = u"\xed\xf3\xb4\x90"
>>> print x
íó´
How could I use s1
to print this?
I have tried:
s1= "\xed\xf3\xb4\x90"
print unicode(s1)
But I could not get íó´
. How could I get íó´
?
I have a string like s1 = "\xed\xf3\xb4\x90"
.
>>> x = u"\xed\xf3\xb4\x90"
>>> print x
íó´
How could I use s1
to print this?
I have tried:
s1= "\xed\xf3\xb4\x90"
print unicode(s1)
But I could not get íó´
. How could I get íó´
?
The correct codec to be used here is
'latin1'
:However using
'unicode-escape'
also works here as'unicode-escape'
assumes the bytes are encoded in'latin1'
and there are no unicode escapes in the OP's string:In this case you can decode the
str
with thelatin1
codec.