list index()

Bruno Desthuilliers bruno.42.desthuilliers at wtf.websiteburo.oops.com
Fri Aug 31 04:28:31 EDT 2007


zzbbaadd at aol.com a écrit :
(snip)
> I don't think that is the definition used across computer science.
> 
> It suddenly dawned on me that what would be best would be a contains()
> (or IN syntax for those who can't afford to wait) for lists.

No need to wait:

 >>> 'a' in ['a', 'b']
True
 >>> ['a', 'b'].__contains__('a')
True





More information about the Python-list mailing list