On Thu, Aug 11, 2011 at 2:48 AM, MRAB <pyt...@mrabarnett.plus.com> 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 alternative - in fact, I wish other systems could work the same way (eg Bible references). If you think about position 0 being the very beginning of the string, and position len(s) being the very end, then you slice the string from position to position and take the characters between. When you index the string for a particular character, you aim at a position and take the character after it. Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list