On 10.11.2008, Mr.SpOOn <[EMAIL PROTECTED]> wroted:

> is there any way to search elements in a list using wildcards?
>
> I have a list of various elements and I need to search for elements
> starting with 'no', extract them and put in a new list.
> I was thinking about something like:
>
> mylist.index('no*')
>
> Of course this doesn't work.

I guess there's a way to use the glob module in this situation, but 
for the specific case I think you can use:

start_with_no = (i for i in mylist if i.startswith("no"))

GS
-- 
Grzegorz Staniak <gstaniak _at_ wp [dot] pl>
Nocturnal Infiltration and Accurate Killing
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to