On Mon, Nov 2, 2009 at 10:11 PM, Aahz <a...@pythoncraft.com> wrote:
> In article 
> <7589e0a1-98b2-4df4-bc76-5d4c10194...@f20g2000prn.googlegroups.com>,
> Falcolas  <garri...@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

If you don't want Nones in your list just make a check for it...
[s.strip() for s in hosts if s is not None and s.strip()]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to