Am Samstag, 9. April 2005 11:37 schrieb Michael Spencer:
> praba kar wrote:
> > I want to check a list have specific
> > value or not. So If any one know regarding this
> > mail me
> A minute of two experimenting, would then lead you to:
>   >>> l = [1,2,3,4,5]
>   >>> l.index(3)
>
>   2

Or, if its that you just want to know whether a value is somewhere in an 
iterable:

>>> l = [1,2,3,4,5]
>>> 4 in l
True

See how there is special syntax to call the __contains__ method of the 
iterable automatically.

-- 
--- Heiko.
listening to: Pearl Jam - Rearviewmirror
  see you at: http://www.stud.mh-hannover.de/~hwundram/wordpress/

Attachment: pgp73dFMahMxZ.pgp
Description: PGP signature

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to