Python: cleaner list comprehension

Posted by Jasie on Stack Overflow See other posts from Stack Overflow or by Jasie
Published on 2010-05-04T03:25:40Z Indexed on 2010/05/04 3:28 UTC
Read the original article Hit count: 255

Filed under:
|

Is there a cleaner way to write this:

for w in [w for w in words if w != '']:

I want to loop over a dictionary words, but only words that aren't whitespace. Thanks!

© Stack Overflow or respective owner

Related posts about python

Related posts about list-comprehension