"Christian Witts" <[email protected]> wrote


lines = [line for line in infile if line[146:148] not in omit_states]
print ''.join(lines)

Just remember that doing a list comprehension like that on a large file will drastically reduce the speed of your application as well as introduce memory bloat.

Given he was originally doing an explicit for loop over the file I doubt if
the comprehension will be any slower. But it may well use  more memory.

Alan G.

_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to