itertools.count() as built-in

Duncan Smith buzzard at urubu.freeserve.co.uk
Mon May 29 11:36:40 EDT 2006


jantod at gmail.com wrote:
> Zipping an xrange? I'm having trouble visualizing how you do that to
> avoid x*i+y.
> 
> -Janto
> 

Something like,

>>> lis =  ['a', 'b', 'c', 'd']
>>> y = 3
>>> i = 7
>>> for n, item in zip(xrange(y, len(lis)*i+y, i), lis):
	print n, item

	
3 a
10 b
17 c
24 d
>>>

Duncan



More information about the Python-list mailing list