interleave string

Steven D'Aprano steve+comp.lang.python at pearwood.info
Wed Feb 16 08:25:36 EST 2011


On Tue, 15 Feb 2011 19:39:30 -0800, alex23 wrote:

> Andrea Crotti <andrea.crott... at gmail.com> wrote:
>> At the moment I have this ugly inliner
>>         interleaved = ':'.join(orig[x:x+2] for x in range(0,
>>         len(orig), 2))
> 
> I actually prefer this over every other solution to date.

Agreed. To me, it's the simplest, least contrived way to solve the 
problem. 


-- 
Steven



More information about the Python-list mailing list