-
-
Save qingfeng/236746 to your computer and use it in GitHub Desktop.
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
from __future__ import with_statement | |
import os,sys | |
def find_condition(filename,condition): | |
with open(filename) as f: | |
for i in f: | |
i = i.strip() | |
data = i.split('|') | |
if condition == data[2]: | |
yield i | |
if __name__ == '__main__': | |
filename = sys.argv[1] | |
condition = str(sys.argv[2]) | |
for d in find_condition(filename,condition): | |
print d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment