index(x)
Peter Hansen
peter at engcorp.com
Thu Jun 12 10:43:39 EDT 2003
Tom wrote:
>
> I compare all items in a list with another value. There are always
> multiple matches. I need the list index of every match. But if I use
> index(x) it only returns the first match in that list. There is probably
> a similar command that does exactly what I want, but I can't find it.
It's unfortunate perhaps that list.index() does not support the optional
second argument that specifies a starting index for the search, as the
string.index() method does. I wonder if this is an inconsistency that
should be repaired, or if there's a technical reason for its existence.
-Peter
More information about the Python-list
mailing list