How to check if a list contains an item

MRAB google at
Sun Apr 12 21:29:21 CEST 2009 at wrote:
> python doesn't have a list.contains()   method?
It does have a __contains__ method, but that's not called directly. Use
"item in my_list" instead (and the opposite is "item not in my_list").

More information about the Python-list mailing list