Saturday, 1 May 2021

How can I remove all numbers from a list of strings?

I have a list which contains a string of numbers and letters:

list = ["North East, 22.5, 13.6", "South West, 19.8, 34.2"]

How can I remove the numbers and just get:

words = ["North East", "South West"]

I have tried:

numbers = "123456789"
for item in list:
    if item in numbers:
        list.remove(item)


from How can I remove all numbers from a list of strings?

No comments:

Post a Comment