Re: Bizarre behavior of the 'find' method of strings

2011-08-10 Thread Jim
Thanks for all you guys. Now I got it. To Steven, I was in a little rush when I put this post. But you are right. It's not the find method's problem. -- http://mail.python.org/mailman/listinfo/python-list

Re: Bizarre behavior of the 'find' method of strings

2011-08-10 Thread Chris Rebert
On Wed, Aug 10, 2011 at 7:56 PM, Steven D'Aprano wrote: > On Thu, 11 Aug 2011 11:24 am Jim wrote: > >> Greetings, folks, >> >> I am using python 2.7.2. Here is something I got: > a = 'popular' > i = a.find('o') > j = a.find('a') > a[i:j] >> 'opul' >> >> Well, I expected a[i:j] to b

Re: Bizarre behavior of the 'find' method of strings

2011-08-10 Thread Steven D'Aprano
ul' > > Well, I expected a[i:j] to be 'opula', and can't think of any reason why > this is not happening. So, can anybody help me out about this? Thank you > very much. Your subject line says: Bizarre behavior of the 'find' method of strings What makes you

Re: Bizarre behavior of the 'find' method of strings

2011-08-10 Thread Chris Angelico
On Thu, Aug 11, 2011 at 2:48 AM, MRAB wrote: > Python uses half-open ranges, which means that the start position is > inclusive and the end position is exclusive. > Or if you prefer: Python identifies positions between characters, rather than characters. And I agree that it's better than the alte

Re: Bizarre behavior of the 'find' method of strings

2011-08-10 Thread MRAB
On 11/08/2011 02:24, Jim wrote: Greetings, folks, I am using python 2.7.2. Here is something I got: a = 'popular' i = a.find('o') j = a.find('a') a[i:j] 'opul' Well, I expected a[i:j] to be 'opula', and can't think of any reason why this is not happening. So, can anybody help me out about thi

Bizarre behavior of the 'find' method of strings

2011-08-10 Thread Jim
Greetings, folks, I am using python 2.7.2. Here is something I got: >>> a = 'popular' >>> i = a.find('o') >>> j = a.find('a') >>> a[i:j] 'opul' Well, I expected a[i:j] to be 'opula', and can't think of any reason why this is not happening. So, can anybody help me out about this? Thank you very m