jeudi 9 juillet 2020

Append string to new list if it doesn't include certain words

bad_words = ['Hi', 'hello', 'cool']
new_strings = []
for string in old_strings:
    if bad_words not in old_strings: ?????????????????????????????????????????????????????????
        new_strings.append(string)

how do I iterate through bad_words so that it doesnt include the strings that have them in it?

Aucun commentaire:

Enregistrer un commentaire