Skip to content

Instantly share code, notes, and snippets.

@lambdamusic
Created February 7, 2013 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lambdamusic/4734288 to your computer and use it in GitHub Desktop.
Save lambdamusic/4734288 to your computer and use it in GitHub Desktop.
Python: Break a list into n sublists
mylist = range(150)
nestedlist = [mylist[start:start + 20] for start in range(0, len(mylist), 20)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment