>>> xs = 'abcde' >>> xs[0] 'a' >>> xs[-1] 'e' >>> xs[4] 'e' >>> xs[5] Traceback (most recent call last): File "", line 1, in IndexError: string index out of range >>> xs[-6] Traceback (most recent call last): File "", line 1, in IndexError: string index out of range >>> xs[3:] 'de' >>> xs[4:] 'e' >>> xs[5:] ''