For example
(Python 2.3) >> x="Hello World" >> print x.__contains__("Hello") True
(Python 2.2)
>>> x="Hello world" >>> print x.__contains__("Hello")
Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: 'in <string>' requires character as left operand
Is there any woraround for this or what am i doing wrong in 2.2 ?
IIRC, until Python 2.3, __contains__ only accepted strings of length 1. Before Python 2.3, I think you needed to do something like:
py> x = 'Hello world' py> x.find('Hello') != -1 True py> x.find('wrld') != -1 False
STeVe -- http://mail.python.org/mailman/listinfo/python-list