Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #makes a copy of a text file and removes lines with a keyword in the copy.
- searchfile = open("alice.txt", "r")
- for line in searchfile:
- if " Alice " not in line:
- destfile=open("edited.txt","a")
- destfile.write(line)
- searchfile.close()
- destfile.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement