How to count number of variables in a dictionary
<p>This is my current code to append different time to the same name id in a dict.</p>

<blockquote>
<pre><code>for name, date, time ,price in reader(f):
          group_dict[name].append([time])
</code></pre>
</blockquote>

<p>my question is how do i count the number of 'time' i have in each key in the dict ? </p>

<p>An example of output is</p>

<pre><code> {(name1): [time1, time2, time3]} 
</code></pre>

<p>and i am trying a way to include the count '3' inside</p>

<pre><code>for key, value in yourDict.iteritems():
    print len(value)
</code></pre>

<p>if you want include to your structure try:</p>

<pre><code>for key, value in yourDict.iteritems():
    yourDict[key] = (value, len(value))
</code></pre>

<p>Code for python2 for python 3 use items() instead of iteritems()</p>

python csv count