Why does Python show the whole array?

Hrvoje Niksic hniksic at xemacs.org
Thu Apr 9 17:54:27 CEST 2009


John Posner <jjposner at snet.net> writes:

> Q: Has anyone on the python-dev list ever proposed a "string"-module
> function that does the job of the "in" operator? Maybe this:
>
>  if test.contains(item)     # would return a Boolean value

That's a string method, not a function in the string module.  If you
want a function, use operator.contains:

>>> import operator
>>> operator.contains('foo', 'o')
True



More information about the Python-list mailing list