"James Stroud" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> I like this, it works for any integer.
> >>> str="asdfjkl;"
> >>> i=-400
> >>> print str[:i]+str[i:]
> asdfjkl;
> >>> i = 65534214
> >>> print str[:i]+str[i:]
> asdfjkl;

Actually, this has no relation with the half-open
slices but with the fact that if i goes beyond
the limit of the string then Python, wisely, doesn't
raise an error but instead return the string until
the end. When people say that half-open slices work
for every i, they are tinking in the case i=0.

Javier

___________________________________________________________
Javier Bezos                | TeX y tipografía
jbezos at wanadoo dot es    | http://perso.wanadoo.es/jbezos
............................|...............................
CervanTeX (Spanish TUG)     | http://www.cervantex.org






-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to