"str.contains(part)" or alternatives?

Pete Shinners pete at shinners.org
Thu Sep 12 17:19:30 CEST 2002


Delaney, Timothy wrote:
> In fact, this was the deciding factor in Guido changing his position on 'if
> s1 in s2'. A string has sequence-like behaviour (e.g. it is iterable,
> individual characters can be indexed), but also has its own behaviour (e.g.
> substring containment, all elements are single-character strings).

does this mean we can also now do this? if so, nifty

 >>> 1,2,3 in range(10)
1
 >>> 3,2,1 in range(10)
0





More information about the Python-list mailing list