I'm opening two files - one that contains the new file for comparison and one that contains the buzz words I need to remove from this file. I have this as a function so far:
def remove(file, buzz):
#outer for loop cycles through the buzz file
for line in buzz:
#inner for loop cycles through the new file
for line2 in file:
if (line==line2):
file.remove(line2)
else:
continue
where file is the new file that has been opened in main()
and being passed to this, and buzz
is the buzz file that is being opened and passed from main()
.
The removal section is not working and the new file does not change.
Any suggestions?