2013/1/13 Tim Chase <python.l...@tim.thechases.com>: > On 01/13/13 06:45, subhabangal...@gmail.com wrote: > >>>> SIZE = 3 >>>> for i in range(len(list1)//SICE): > ... print list1[i*SIZE:i*SIZE+SIZE] > ... > [1, 2, 3] > [4, 5, 6] > [7, 8, 9] > [10, 11, 12] >
A little shorter and simpler version: >>> x = x[1:] >>> for i in range(0,len(x),SIZE): ... print x[i: i+SIZE] ... [1, 2, 3] [4, 5, 6] [7, 8, 9] [10, 11, 12] Hope it helps > Hope this helps, > > -tkc -- http://mail.python.org/mailman/listinfo/python-list