Hi Mr. Cain, Mae culpa: obviously, I erroneously understood the number after the ':' as the string length. Thanks, Ron.
-----Original Message----- From: D'Arcy J.M. Cain [mailto:da...@druid.net] Sent: Tuesday, December 16, 2008 15:45 To: Barak, Ron Cc: python-list@python.org Subject: Re: String slices work only for first string character ? On Tue, 16 Dec 2008 13:35:27 +0000 "Barak, Ron" <ron.ba...@lsi.com> wrote: > Can any one explain why the following string slice works only for the first > character, but not for any other ? I think that you need to reread the docs on slices. > print "|"+data[0:1]+"|" > print "|"+data[1:1]+"|" If you want the second character use "data[1:2]". -- D'Arcy J.M. Cain <da...@druid.net> | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner. -- http://mail.python.org/mailman/listinfo/python-list