I want to when I input a string, if words in string is contain in a list of words, delete words in the strings
Asked
Active
Viewed 47 times
-1
-
Please don't overwrite the built-in `list`. – tgikal Aug 16 '18 at 16:43
1 Answers
1
Or, you could do the following:
raw_string = input("Enter String:")
useless_list = ["Birds", "Cat"]
print(' '.join([i for i in raw_string.split() if i not in useless_list]))

tgikal
- 1,667
- 1
- 13
- 27

Rushabh Mehta
- 1,529
- 1
- 13
- 29
-
How I can delete words in raw_string if useless_list contains any words of raw_string to delete the occurences ? – Vincent Dugoua Aug 17 '18 at 08:19
-