Thanks to all who pointed my wrong understanding of how string slices are
defined.
Bye,
Ron.
From: Barak, Ron [mailto:ron.ba...@lsi.com]
Sent: Tuesday, December 16, 2008 15:35
To: python-list@python.org
Subject: String slices work only for first string character
ect: Re: String slices work only for first string character ?
On Tue, 16 Dec 2008 13:35:27 +
"Barak, Ron" 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 o
On Tue, 16 Dec 2008 13:35:27 +
"Barak, Ron" 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 seco
Can any one explain why the following string slice works only for the first
character, but not for any other ?
$ cat /tmp/tmp.py
#!/usr/bin/env python
data = 'F0023209006-0101'
print data
print "|"+data[0:1]+"|"
print "|"+data[1:1]+"|"
print "|"+data[2:1]+"|"
$ python `cygpath -w /tmp/tmp.py`
Hi,
Can any one explain why the following string slice works only for the first
character, but not for any other ?
$ cat /tmp/tmp.py
#!/usr/bin/env python
data = 'F0023209006-0101'
print data
print "|"+data[0:1]+"|"
print "|"+data[1:1]+"|"
print "|"+data[2:1]+"|"
$ python `cygpath -w /tmp/tmp.