Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #7018
| From | Vito 'ZeD' De Tullio <zak.mc.kraken@libero.it> |
|---|---|
| Subject | Re: Lambda question |
| Followup-To | gmane.comp.python.general |
| Date | 2011-06-04 21:34 +0200 |
| References | <20110604174624.V8FO6.213264.root@cdptpa-web07-z02> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2457.1307216114.9059.python-list@python.org> (permalink) |
Followups directed to: gmane.comp.python.general
jyoung79@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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Lambda question Vito 'ZeD' De Tullio <zak.mc.kraken@libero.it> - 2011-06-04 21:34 +0200
csiph-web