I am tokenizing a string into words and then want to remove any word which contains a number.
tokens = ['hello', 'world', '12', '1-3', '23'']
As you can see, the numbers come in various forms. The above three are just examples. I can loop through the string items and see if there is a digit and remove that string. However, that doesn't seem right.
The isdigit() function doesn't work on such number-strings. How can I achieve this?
Goal: Any token which contains a digit should be removed. my current code is something like this which doesn't handle the above types:
relevant_tokens = [token for token in tokens if not token.isdigit()]