[Python-ideas] min_fields argument to str.split()

Mathias Panzenböck grosser.meister.morti at gmx.net
Wed Jan 21 14:55:08 CET 2009


Arnaud Delobelle schrieb:
>
> How about this?
>
>>>> from itertools import *
>>>> def fixlen(iterable, len, item=None):
> ...     return islice(chain(iterable, repeat(item)), len)
> ...
>>>> list(fixlen([1, 2, 3], 5))
> [1, 2, 3, None, None]
>

I like this. Maybe an addition to itertools?

+1



More information about the Python-ideas mailing list