Extract the year and the month from a line in a file and use a map to print every time its found to add 1 to the value
<pre><code>def Stats():
    file = open('mbox.txt')
    d = dict()
    for line in file:
        if line.startswith('From'):
            words = line.split()
            for words in file:
                key = words[3] + " " + words[6]
                if key:
                    d[key] +=1
    return d
</code></pre>

<p>The line reads</p>

<pre><code>From stephen.marquard@uct.ac.za Sat Jan  5 09:14:16 2008
</code></pre>

<p>I want to pull "Jan 2008" as the key   </p>

<p>My error message: </p>

<pre><code>Traceback (most recent call last):
  File "C:\Users\Robert\Documents\PYTHON WORKSPACE\Program 1.py", line 78, in &lt;module&gt;
  File "C:\Users\Robert\Documents\PYTHON WORKSPACE\Program 1.py", line 76, in &lt;module&gt;
  File "C:\Users\Robert\Documents\PYTHON WORKSPACE\Program 1.py", line 63, in &lt;module&gt;
builtins.KeyError: 'u -'
</code></pre>