with open('oldfile.txt') as oldfile:
    with open('newfile.txt', 'w') as newfile:
        for line in oldfile:
            if not any(bad_word in line for bad_word in bad_words):
                newfile.write(line)
Удалить строки, содержащие определенную строку