Skip to content

Instantly share code, notes, and snippets.

@Sourceless
Created August 19, 2013 17:17
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 Sourceless/6271614 to your computer and use it in GitHub Desktop.
Save Sourceless/6271614 to your computer and use it in GitHub Desktop.
def columns(list_of_lists):
# Assumes all lists are same length as first, or longer
columns = len(list_of_lists[0])
list_of_lists = [iter(list_) for list_ in list_of_lists]
for _ in xrange(columns):
yield [list_iter.next() for list_iter in list_of_lists]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment