Generation

generate functionThu, 11 May 2023

delete all of the world that in a list from a txt file

def delete_words(words, filename): f = open(filename,'r') lines = f.readlines() for line in lines: for word in words: line = line.replace(word,'') print(line) f.close()

Questions about programming?Chat with your personal AI assistant