Possible Duplicate:
How do you split a list into evenly sized chunks in Python?
I Have a function like below:
def split_list(self,my_list,num):    
    .....    
    .....
where my_list is:
my_list = [['1','one'],['2','two'],['3','three'],['4','four'],['5','five'],['6','six'],['7','seven'],['8','eight']]
I want to split list by given num:
i.e if num = 3
then output will be :  [[['1','one'],['2','two'],['3','three']],[['4','four'],['5','five'],['6','six']],[['7','seven'],['8','eight']]]
if num =4 then
[[['1','one'],['2','two'],['3','three'],['4','four']],[['5','five'],['6','six'],['7','seven'],['8','eight']]]
 
     
     
     
    