title: Python: How to initialize a nested list with empty values which i can append to
body: <p>i'm learning python and hit a wall.
  I am trying to define a 2d list which i can later use to append values. This corresponding to a grid of width *height</p>
  
  <p>I tried using [] to initialize the empty lists but then the wid is ignored.
  I tried using None as a placeholder but then i can't append</p>
  
  <pre><code>wid = 3
  hgt = 3
  l1 = [[]*wid ] * hgt
  l = [[None]*wid ] * hgt
  l[1][1].append("something")
  </code></pre>
  
  <p>Result</p>
  
  <pre><code>l1: [[], [], []]
  
  l: [[None, None, None], [None, None, None], [None, None, None]]
  </code></pre>
  
  <p>Error:    </p>
  
  <pre><code>append: AttributeError: 'NoneType' object has no attribute 'append'
  </code></pre>
  
  <p>desired result: <code>[[[], [], []], [[], [], []], [[], [], []]]</code></p>