Last active
August 29, 2015 14:09
-
-
Save chapinb/af709f104e5374cf2b20 to your computer and use it in GitHub Desktop.
Read & Search lines of a file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fin = inputFile | |
fout = open('logfile.txt'), 'w') | |
flag = False | |
with open(fin, 'r') as infile: | |
content = infile.readline() | |
if content.startwith("diff --"): | |
content2 = infile.readline() # read next line and see if it has keyword | |
if content2.__contains__("keyword"): | |
fout.write(content) | |
cout.floush() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment