code: def f2lookup(f, lookup):
  	
  	lookup = {i: r for i, r in [l.strip().split('\t')[0:2] for l in lookup]}
  	for line in f:
  		line = line.strip()
  		for find, replace in list(lookup.items()):
  			line = line.replace(find, replace)
  		yield line
docs: find and replace elements in lookup within file