Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #searches a text file for a keyword and prints the lines that match.
- searchfile = open("alice.txt", "r")
- for line in searchfile:
- if " left " in line: print (line) #spaces around keyword ensure accuracy
- searchfile.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement