Code:
date = [item.find(class_='wr-date__light').get_text() for item in items]
Ouput:
['31st\xa0January', '1st\xa0February', '3rd\xa0February', '4th\xa0February', '5th\xa0February', '6th\xa0February', '7th\xa0February', '8th\xa0February']
Code:
date = [item.find(class_='wr-date__light').get_text() for item in items]
Ouput:
['31st\xa0January', '1st\xa0February', '3rd\xa0February', '4th\xa0February', '5th\xa0February', '6th\xa0February', '7th\xa0February', '8th\xa0February']
You can use string replacement to remove the characters. And you can use map
to apply that to every element of the list.
date = list(map(lambda s: s.replace('\xa0', ''), date))
If you are not comfortable using lambda
expressions, you can define a new function.
def replace(text):
return text.replace('\xa0', '')
date = list(map(replace, date))