from itertools import izip def pairs( lst): a = iter(lst) return izip(a, a) for i, j in pairs( range(10)): print( "%d %d" % (i, j)) ”' the output: 0 1 2 3 4 5 6 7 8 9 ”'