title: Python how to use defaultdict fromkeys to generate a dictionary with predefined keys and empty lists
body: <p>Here is the code:</p>
  
  <pre><code>from collections import defaultdict
  
  result = defaultdict.fromkeys(['a','b','c'], list)
  result['a'].append(1)
  
  ---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-44-6c01c8d56a42&gt; in &lt;module&gt;()
  ----&gt; 1 result['a'].append('1')
  
  TypeError: descriptor 'append' requires a 'list' object but received a 'str'
  </code></pre>
  
  <p>I don't understand the error message, what went wrong and how to fix it?</p>