How do I search a text file for a key-phrase or keyword and then print the line that key-phrase or keyword is in?
with open('file.txt', 'r') as searchfile: for line in searchfile: if 'searchphrase' in line: print line
With apologies to senderle who I blatantly copied.