"str.contains(part)" or alternatives?
Sean 'Shaleh' Perry
shalehperry at attbi.com
Thu Sep 12 11:30:14 EDT 2002
On Thursday 12 September 2002 08:19, Pete Shinners wrote:
> 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
I hope not. 1,2,3 should evaluate to a tuple and the tuple (1,2,3) is not in
[1,2,...,10].
More information about the Python-list
mailing list