You can read about the behaviour of string slicing at https://docs.python.org/2/tutorial/introduction.html#strings, which includes an illustration of how to interpret indices.
In particular, it states:
One way to remember how slices work is to think of the indices as pointing between characters, with the left edge of the first character
numbered 0. Then the right edge of the last character of a string of n
characters has index n, for example:
+---+---+---+---+---+---+
| P | y | t | h | o | n |
+---+---+---+---+---+---+
0 1 2 3 4 5 6
-6 -5 -4 -3 -2 -1
The first row of numbers gives the position of the indices 0...6 in the string; the second row gives the corresponding negative
indices. The slice from i to j consists of all characters between the
edges labeled i and j, respectively.
(Emphasis mine)
When i
and j
are both 0
(and i
defaults to 0
if not specified), there are no characters between them, so the resulting substring is the empty string, ""
, which has type str
and length 0
.