[EMAIL PROTECTED] wrote: > Lorn Davies wrote: > > > if (fields[8] == 'N' or 'P') and (fields[6] == '0' or '1'): > > ## This line above doesn't work, can't figure out how to struct? > > In Python you would need to phrase that as follows: > if (fields[8] == 'N' or fields[8] == 'P') and (fields[6] == '0' > or fields[6] == '1'): > or alternatively: > if (fields[8] in ['N', 'P']) and (fields[6] in ['0', '1']): >
and given that the files are huge, a little bit of preprocessing wouldn't go astray: initially: valid_8 = set(['N', 'P']) valid_6 = set(['0', '1']) then for each record: if fields[8] in valid_8 and fields[6] in valid_6: More meaningful names wouldn't go astray either :-) -- http://mail.python.org/mailman/listinfo/python-list