0

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']
Yam Mesicka
  • 5,811
  • 7
  • 41
  • 62
gogulcv
  • 23
  • 3

1 Answers1

0

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))
jakub
  • 13,953
  • 2
  • 30
  • 52