Skip to content Skip to sidebar Skip to footer

Python: Complicated Loop Through List

import csv import collections def do_work(): (data,counter)=get_file('thefile.csv') b=samples_subset1(data,counter,'/pythonwork/samples_subset4.csv',500) medications_subset2

Solution 1:

I didn't really read your code paragraph, but from the problem you described afterwards it sounds like you want:

needed = set(['ALGIDON','ALGOLYSIN','AMIDON','DEPRIDOL','DOLOPHINE','FENADONE', 'METHADOSE','MIADONE','PHENADONE'])
b = filter(lambda s: len(set(s.upper().split(',')) & needed) > 0, b)

Post a Comment for "Python: Complicated Loop Through List"