Advertisement
182days

Text File Keyword Remover

May 10th, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. #makes a copy of a text file and removes lines with a keyword in the copy.
  2. searchfile = open("alice.txt", "r")
  3. for line in searchfile:
  4.     if " Alice " not in line:
  5.         destfile=open("edited.txt","a")
  6.         destfile.write(line)
  7. searchfile.close()
  8. destfile.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement