String negative indices?

Filip Wasilewski filipwasilewski at gmail.com
Fri Jun 23 05:17:39 EDT 2006


drtimhill at comcast.net wrote:

> Logically, I should be able to enter x[-2:-0] to get the last and next to last characters. However, since Python doesn't distinguish between positive and negative zero, this doesn't work. Instead, I have to enter x[-2:].

Hooray! Logically there is no such thing as positive or negative zero,
or did I miss something in the primary?

PS. x[len(x)-2 : len(x)-0]

cheers,
fw




More information about the Python-list mailing list