Created
May 26, 2010 18:18
-
-
Save chrisedgemon/414844 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> def x(lst, cols): | |
... if cols == 0: return [] | |
... slice = len(lst) / cols | |
... if len(lst) % cols: | |
... slice += 1 | |
... return [lst[:slice]] + x(lst[slice:], cols-1) |
Author
chrisedgemon
commented
May 26, 2010
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment