your_string = [i for i in range(20)] n= 5 parts = [your_string[i:i+n] for i in range(0, len(your_string), n)] print(parts) #[[0, 1, 2, 3, 4], [5, 6, 7, 8, 9], [10, 11, 12, 13, 14], [15, 16, 17, 18, 19],]