Bizarre behavior of the 'find' method of strings

Jim jianbao.tao at gmail.com
Thu Aug 11 03:24:53 CEST 2011


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 much.

Jim



More information about the Python-list mailing list