Skip to content

Instantly share code, notes, and snippets.

@qingfeng
Forked from mactanxin/gist:236732
Created November 17, 2009 07:16
Show Gist options
  • Save qingfeng/236746 to your computer and use it in GitHub Desktop.
Save qingfeng/236746 to your computer and use it in GitHub Desktop.
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