I have a file with the following line:
raúl fernando sendic rodríguez is the leader of uruguay .
I am reading the file doing:
l = open(file_name).read().split()
And I get:
['ra\xc3\xbal', 'fernando', 'sendic', 'rodr\xc3\xadguez', 'is', 'the', 'leader', 'of', 'uruguay', '.']
I want to convert it to a unicode string with the u
in the begining, but so far I tried:
print list(map(lambda a: unicode(a, "utf-8"), l))
print list(map(lambda a: a.decode('utf-8'), l))
And got (same for both):
[u'ra\xfal', u'fernando', u'sendic', u'rodr\xedguez', u'is', u'the', u'leader', u'of', u'uruguay', u'.']
How can I properly decode that string as unicode?
Note: This is python 2.7