python - Removing \xa0 from string in a list -
i have list bunch of words:
lista = ['jeux olympiques de rio\xa02016', 'sahara ray', 'michael phelps', 'amber alert'] i tried replace '\xa0':
for element in listor: element = element.replace('\xa0',' ') but didn't work. also, when print elements, prints:
print(lista[0]) jeux olympiques de rio 2016 does have idea on how solve this?
the easiest way:
lista = [el.replace('\xa0',' ') el in lista]
Comments
Post a Comment