How to find an item/items in a list?

Asun Friere afriere at yahoo.co.uk
Mon May 5 21:07:36 EDT 2003


"Bjorn Pettersen" <BPettersen at NAREX.com> wrote in message news:<mailman.1052152586.21394.python-list at python.org>...
> So, for some reasong I've been trying to find the "next" value (or all
> following values) after a certain "item" in a list. It's easy to do:
> 
>   nextVals = lst[lst.index(item)+1:]
> 
Yeah, not to good for the last item of a list, but note that any
method based on 'index' will only work if you can guarantee the
uniqueness of values in your list in any case.




More information about the Python-list mailing list