Home
Head's Up: I'm in the middle of upgrading my site. Most things are in place, but there are something missing and/or broken including image alt text. Please bear with me while I'm getting things fixed.

Make a 2d array with object in python

This is how to prepopulate a two dimensional list of lists (aka array of arrays) with objects in python.

python
from pprint import pprint

  grid = []

  rows = 4
  cols = 3

  for i in range(0, rows):
    grid.append([{"k": "v"}] * cols)

  pprint(grid)
results start