Skip to content

Instantly share code, notes, and snippets.

@le-dawg
Created June 25, 2017 21:13
Show Gist options
  • Save le-dawg/d354551f18e9cc18c6fd5beeb2c64500 to your computer and use it in GitHub Desktop.
Save le-dawg/d354551f18e9cc18c6fd5beeb2c64500 to your computer and use it in GitHub Desktop.
Easily initialize 2D list
    # Rapidly initalize 2D list
2dlist = [[0] * 3 for i in xrange(3)]
print(2dlist)
# [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment