title: Dictionary with array of different types as value in Python
body: <p>I am learning Python and I have a dictionary like this:</p>
  
  <pre><code>category = { "World news": [0], "Politics": [0], ... }
  </code></pre>
  
  <p>where now I am reading articles from a file. Every article has a category. So I would like the 0 I have to every key to be incremented by 1 when a category is meet and to augment the array every key has with the article it found. So the output would be:</p>
  
  <pre><code>category = {  "World news": [2, "foo bla content of", "content of 2nd article"],
                "Politics": [1, "only 1 article here"],
                ...
  }
  </code></pre>
  
  <p>Here is what I have now:</p>
  
  <pre><code>for row in iter_reader:
      category[row[4]][0] = category[row[4]][0] + 1
      category[row[4]].append(category[row[3]])
  </code></pre>
  
  <p>but I think it interprets an article as a key and throws a relevant error:</p>
  
  <blockquote>
    <p>File "./wordCloud.py", line 41, in 
        category[row[4]].append(category[row[3]])
    KeyError: 'When Apple unveiled its in January 2010..</p>
  </blockquote>
  
  <p>Any ideas please?</p>
  
  <hr>
  
  <p><code>row[4]</code> is the category of the article.
  <code>row[3]</code> is the content of the article.</p>
  
  <p>As Bryan Oakley said, I do not need to keep a counter, so I am now thinking in this direction...</p>