get each pair from a string.

Emile van Sebille emile at fenx.com
Mon Oct 22 02:45:39 EDT 2012


On 10/21/2012 11:33 AM, 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.
>

How far have you gotten?  Show us the loops you're trying now and any 
errors you're getting.

Emile






More information about the Python-list mailing list