On Sun, Sep 16, 2012 at 8:33 PM, eryksun wrote:
>
> The 'in' operator also searches for a substring:
>
> >>> '' in 'abc'
> True
I forgot to mention, this use of slices is a peculiarity to strings.
In contrast, list.index and list.__contains__ ("in") match against
individual items. An empt
On Sun, Sep 16, 2012 at 7:51 PM, Don Jennings wrote:
> This behavior seems strange to me: the find method of a string returns the
> position zero when you search for an empty string (granted, I can't quite
> figure out why you'd search for an empty string, either).
>
'abc'.find('')
> 0
>
>
This behavior seems strange to me: the find method of a string returns the
position zero when you search for an empty string (granted, I can't quite
figure out why you'd search for an empty string, either).
>>> 'abc'.find('')
0
Anyone care to share a good explantion for this behavior and possi