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:[email protected]] Sent: Tuesday, December 16, 2008 15:45 To: Barak, Ron Cc: [email protected] Subject: Re: String slices work only for first string character ? On Tue, 16 Dec 2008 13:35:27 +0000 "Barak, Ron" <[email protected]> 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 <[email protected]> | 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
