Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #63889
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2014-01-14 02:51 -0800 |
| References | (2 earlier) <mailman.5439.1389691509.18130.python-list@python.org> <41a71031-be78-475f-bab2-822e35f909b7@googlegroups.com> <mailman.5443.1389693753.18130.python-list@python.org> <b92f81cf-0701-46cf-9d4f-2b15654b94f7@googlegroups.com> <mailman.5449.1389695737.18130.python-list@python.org> |
| Message-ID | <edec3c52-fb70-46ef-b70e-16553320c941@googlegroups.com> (permalink) |
| Subject | Re: What's correct Python syntax? |
| From | Rustom Mody <rustompmody@gmail.com> |
On Tuesday, January 14, 2014 4:05:27 PM UTC+5:30, Igor Korot wrote:
> Hi, Rustom,
>
>
>
> On Tue, Jan 14, 2014 at 2:16 AM, Rustom Mody wrote:
> > You want this?
> >
> >>>> test = "I,like,my,chocolate"
> >>>> test.split(',')
> > ['I', 'like', 'my', 'chocolate']
> >>>> test.split(',')[2:4]
> > ['my', 'chocolate']
>
>
> Yup, thats it.
> Now 2 and 4 - it's a starting point and ending point, right?
In python ranges are usually lo-inclusive hi-exclusive.
Slices are one case of this
See explanations:
http://docs.python.org/2/tutorial/introduction.html#strings
and
http://stackoverflow.com/questions/509211/pythons-slice-notation
Neat theoretical explanation
http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
What's correct Python syntax? Igor Korot <ikorot01@gmail.com> - 2014-01-14 00:46 -0800
Re: What's correct Python syntax? Rustom Mody <rustompmody@gmail.com> - 2014-01-14 00:54 -0800
Re: What's correct Python syntax? Igor Korot <ikorot01@gmail.com> - 2014-01-14 01:25 -0800
Re: What's correct Python syntax? Rustom Mody <rustompmody@gmail.com> - 2014-01-14 01:37 -0800
Re: What's correct Python syntax? Igor Korot <ikorot01@gmail.com> - 2014-01-14 02:02 -0800
Re: What's correct Python syntax? Rustom Mody <rustompmody@gmail.com> - 2014-01-14 02:16 -0800
Re: What's correct Python syntax? Igor Korot <ikorot01@gmail.com> - 2014-01-14 02:35 -0800
Re: What's correct Python syntax? Rustom Mody <rustompmody@gmail.com> - 2014-01-14 02:51 -0800
Re: What's correct Python syntax? Roy Smith <roy@panix.com> - 2014-01-14 08:47 -0500
Re: What's correct Python syntax? Peter Otten <__peter__@web.de> - 2014-01-14 12:33 +0100
Re: What's correct Python syntax? Ned Batchelder <ned@nedbatchelder.com> - 2014-01-14 07:19 -0500
Re: What's correct Python syntax? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-01-14 08:58 -0500
Re: What's correct Python syntax? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-01-14 09:37 +0000
Fwd: What's correct Python syntax? Igor Korot <ikorot01@gmail.com> - 2014-01-14 02:03 -0800
Re: Fwd: What's correct Python syntax? Larry Hudson <orgnut@yahoo.com> - 2014-01-14 22:00 -0800
Re: What's correct Python syntax? Alister <alister.ware@ntlworld.com> - 2014-01-14 10:59 +0000
Re: What's correct Python syntax? Roy Smith <roy@panix.com> - 2014-01-14 08:34 -0500
csiph-web