title: How can I initialize a dictionary of distinct empty lists in Python?
body: <p>My attempt to programmatically create a dictionary of lists is failing to allow me to individually address dictionary keys. Whenever I create the dictionary of lists and try to append to one key, all of them are updated. Here's a very simple test case:</p>
  
  <pre><code>data = {}
  data = data.fromkeys(range(2),[])
  data[1].append('hello')
  print data
  </code></pre>
  
  <p>Actual result: <code>{0: ['hello'], 1: ['hello']}</code></p>
  
  <p>Expected result: <code>{0: [], 1: ['hello']}</code></p>
  
  <p>Here's what works</p>
  
  <pre><code>data = {0:[],1:[]}
  data[1].append('hello')
  print data
  </code></pre>
  
  <p>Actual and Expected Result: <code>{0: [], 1: ['hello']}</code></p>
  
  <p>Why is the <code>fromkeys</code> method not working as expected?</p>