Skip to content

Instantly share code, notes, and snippets.

@mactanxin
Forked from qingfeng/gist:236746
Created November 18, 2009 02:03
Show Gist options
  • Save mactanxin/237487 to your computer and use it in GitHub Desktop.
Save mactanxin/237487 to your computer and use it in GitHub Desktop.
# -*- coding:utf-8-*-
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.strip('|')[5]
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