gcmartijn> Why is this not working ? gcmartijn> bla = 'hondenriem' gcmartijn> print bla[0:4] # correct ! (= hond) gcmartijn> print bla[3:2] # nothing ! (= en) gcmartijn> print bla[6:3] # nothing ! (= riem)
gcmartijn> Why don't bla[3:2] and bla[6:3] won't work ? Because those two examples define zero-length slices (left index <= right). The second number in each slice specification is the ending index of the slice, not the desired length. >>> bla = 'hondenriem' >>> print bla[0:4] hond >>> print bla[3:2] >>> print bla[2:3] n >>> print bla[6:3] >>> print bla[3:6] den >>> print bla[3:3] Skip -- http://mail.python.org/mailman/listinfo/python-list