Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #31856 > unrolled thread

Re: get each pair from a string.

Started byMark Lawrence <breamoreboy@yahoo.co.uk>
First post2012-10-21 20:05 +0100
Last post2012-10-21 20:05 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: get each pair from a string. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-10-21 20:05 +0100

#31856 — Re: get each pair from a string.

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2012-10-21 20:05 +0100
SubjectRe: get each pair from a string.
Message-ID<mailman.2597.1350846190.27098.python-list@python.org>
On 21/10/2012 19:33, Vincent Davis wrote:
> I am looking for a good way to get every pair from a string. For example,
> input:
> x = 'apple'
> output
> 'ap'
> 'pp'
> 'pl'
> 'le'
>
> I am not seeing a obvious way to do this without multiple for loops, but
> maybe there is not :-)
> In the end I am going to what to get triples, quads....... also.
>
> Thanks
> Vincent
>

I suggest that you try taking slices out of your apple :)  Start here 
http://docs.python.org/tutorial/introduction.html

-- 
Cheers.

Mark Lawrence.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web