Lambda question

Vito 'ZeD' De Tullio zak.mc.kraken at libero.it
Sat Jun 4 15:34:50 EDT 2011


jyoung79 at kc.rr.com wrote:

> I was surfing around looking for a way to split a list into equal
> sections.

non-recursive, same-unreadeable (worse?) one liner alternative:

def chunks(s, j):
    return [''.join(filter(None,c))for c in map(None,*(s[i::j]for i in 
range(j)))]


-- 
By ZeD




More information about the Python-list mailing list