Mr.SpOOn <[EMAIL PROTECTED]> writes: > Hi, > 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 have exactly what you need :) >>> import fnmatch >>> fnmatch.filter(['baba', 'nono', 'papa', 'mama', 'nostradamus'], 'no*') ['nono', 'nostradamus'] >>> HTH -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list