is there a better way to check an array?

Mike Meyer mwm at mired.org
Thu Sep 1 23:25:20 EDT 2005


"Steve M" <sjmaster at gmail.com> writes:
> You can check for membership in a list at least these ways:

Two ways - idnex and the in keyword.

> my_list.find(candidate)
> -returns the index into my_list of the first occurrence of candidate.
> Returns -1 if candidate doesn't occur in my_list.

Lists don't have a find method. strings do. Why is a good question.

      <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list