Nick Coghlan wrote: > Reinhold Birkenfeld wrote: >>>Why not put these together and put it in itertools, since the requirement >>>seems >>>to crop up every other week? >>> >>> >>> line = "A:B:C".split(":") >>> ... >>> >>> def ipad(N,iterable, default = None): >>> ... return it.islice(it.chain(iterable, it.repeat(default)), N) >>> ... >>> >>> a,b,c,d = ipad(4,line) >>> >>> a,b,c,d >>>('A', 'B', 'C', None) >> >> >> Good idea! >> >> (+1 if this was posted on python-dev!) > > Please, please Google the python-dev archives before doing so ;)
I have no intent of doing so, I would leave that to more experienced people... Reinhold ;) -- http://mail.python.org/mailman/listinfo/python-list