list comprehension problem
Aahz
aahz at pythoncraft.com
Mon Nov 2 16:11:28 EST 2009
In article <7589e0a1-98b2-4df4-bc76-5d4c10194fde at f20g2000prn.googlegroups.com>,
Falcolas <garrickp at gmail.com> wrote:
>
>I'd also recommend trying the following filter, since it is identical
>to what you're trying to do, and will probably catch some additional
>edge cases without any additional effort from you.
>
>[s.strip() for s in hosts if s.strip()]
This breaks if s might be None
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
[on old computer technologies and programmers] "Fancy tail fins on a
brand new '59 Cadillac didn't mean throwing out a whole generation of
mechanics who started with model As." --Andrew Dalke
More information about the Python-list
mailing list