fork download
  1. import fileinput
  2.  
  3. last = None
  4. for line in fileinput.input():
  5. mark, sep, value = line.partition('\t')
  6. if not sep: continue # skip lines without a tab
  7. if mark.startswith('>WB'):
  8. last = value.strip()
  9. elif mark.strip() == 'IV':
  10. print('%s\t%s' % (last, value.strip()))
Success #stdin #stdout 0.02s 5908KB
stdin
>WB02	F27C8.1  
IV	B-9641      
>WB03	F07C3.7   
>WB04	F52H2.2   
>WB04	F52H2.2   
>WB05	T13A10.10     
IV	B-15643   
IV	B-11650   
IV	B-13649
stdout
F27C8.1	B-9641
T13A10.10	B-15643
T13A10.10	B-11650
T13A10.10	B-13649