Message 1 of 2
Split list into even chunks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a list of objects and I need to split this list into chunks of 3 using the 'range' function.
Can it be done?
Thanks in advance
sel = cmds.ls(sl = 1)
halfSel = len(sel)/2
chunk_sep = []
for i in range (0,halfSel, 3):
chunk_sep.append([lst[i],lst[i+1],lst[i+2],lst[i+3],lst[i+4]])