I'll tell you two ways
l = [ i for i in range(0,100)]
def divider(l, n):
for i in range(0, len(l), n):
yield(l[i:i+n])
l = list(divider(l, 10))
print l
l = [ i for i in range(0,100)]
l = [l[i:i+10] for i in range(0, len(l), 10)]
print l
© 2024 OneMinuteCode. All rights reserved.