Python: Deleting specific words from a file.
prachar at gmail.com
Fri Sep 9 03:09:31 CEST 2011
Hello, I have a data file (un-structed messy file) from which I have
to scrub specific list of words (delete words).
Here is what I am doing but with no result:
infile = "messy_data_file.txt"
outfile = "cleaned_file.txt"
delete_list = ["word_1","word_2"....,"word_n"]
new_file = 
fout = open(outfile,"w+")
for line in fin:
for word in delete_list:
I have put the code above in a file. When I execute it, I dont see the
result file. I am not sure what the error is. Please let me know what
I am doing wrong.
More information about the Python-list