Is there a better/simpler way to filter blank lines?

tmallen thomasmallen at gmail.com
Tue Nov 4 16:27:00 EST 2008


I'm parsing some text files, and I want to strip blank lines in the
process. Is there a simpler way to do this than what I have here?

lines = filter(lambda line: len(line.strip()) > 0, lines)

Thomas



More information about the Python-list mailing list