SyntaxFix
Write A Post
Hire A Developer
Questions
I'd do it like this:
f = open('test.txt') l = [l for l in f.readlines() if l.strip()] f.close() print l