Skip to content

Instantly share code, notes, and snippets.

@cizixs
Created August 12, 2013 15:17
Show Gist options
  • Select an option

  • Save cizixs/6211754 to your computer and use it in GitHub Desktop.

Select an option

Save cizixs/6211754 to your computer and use it in GitHub Desktop.
reverse a two-dimension array in python
arr = [[1,2,3],[4,5,6],[7,8,9],[10,11,12]]
print [[r[col] for r in arr] for col in rage(len(arr[0]))]
#another simple but confuding way
print map(list, zip(*arr))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment