[Tutor] (no subject)
Ewald Ertl
ewald.ertl at hartter.com
Thu Apr 14 09:21:04 CEST 2005
Hi Jim,
on Thu, 14 Apr 2005 01:09:14 -0500 "Jim and Laura Ahl" <jcahl at psci.net> wrote :
---------------------------------------------------------------------------------------------
Jim and Laura Ahl > How come when I ask it to print i[2:4] from an inputted string it gives me the letters between two and four
Jim and Laura Ahl >
Jim and Laura Ahl > But when I ask it to print i[-1:-4] it does not print anything.
Here you extract a slice starting with the last entry in i and ending much earlier,
so you are asking for a slice with a negative length.
Perhaps what you like is print i[-4:-1] ?
------------------- end ----------------------
HTH Ewald
More information about the Tutor
mailing list