Re: [Tutor] all the slashes
Magnus Lycka
magnus at thinkware.se
Mon Feb 9 15:24:34 EST 2004
> I use the code below in Python 2.3, but in 2.2 it says:
> TypeError: 'in <string>' requires character as left operand
In python versions before 2.3, the in-operator required a
character, i.e. a string of length 1, on the left hand side,
if it had a string on the right hand side.
Escaping is only relevant for back-slashes "\", since they
have a special meaning, such as '\t' meaning the tab character.
The traditional check for substring idiom before 2.3
was:
if long_string.find(sub_string) != -1:
# found!
--
Magnus Lycka, Thinkware AB
Alvans vag 99, SE-907 50 UMEA, SWEDEN
phone: int+46 70 582 80 65, fax: int+46 70 612 80 65
http://www.thinkware.se/ mailto:magnus at thinkware.se
More information about the Tutor
mailing list