I'm trying to write part of a program that takes in a previously generated list where all the items in the list are strings containing both letters and numbers, and removes all the letters.
This is the code I've written to do that:
test = ["test252k", "test253k"]
numbers = list(str(range(0,10)))
for i in test:
i = list(i)
i = [x for x in i if x in numbers]
i = "".join(str(e) for e in i)
test = [i for i in test]
But when I print test, I just get the original list from line 1.
What do I do to ensure that the for loop replaces the original values for i with the new values?