Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Breaks a list into 'n' pieces horizontally.
def partition_horizontal(thelist, n):
break a list into 'n' pieces horizontally
n = int(n)
thelist = list(thelist)
except (ValueError, TypeError):
return [thelist]
newlist = [list() for i in range(n)]
for i, val in enumerate(thelist):
return newlist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.