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

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -