How to generate enumerated tuples from a dictionary with a list comprehension in Python?
<p>How can I write a list comprehension to enumerate key: value pairs into 3-membered tuples from a Python dictionary?</p>

<pre><code>d = {'one': 'val1', 'two': 'val2', 'three': 'val3', 'four': 'val4', 'five': 'val5'}
</code></pre>

<p>When I try this:</p>

<pre><code>li = [(index, k, val) for index, k, val in enumerate(d.items())]
</code></pre>

<p>I get a <code>ValueError: need more than 2 values to unpack</code></p>

<p>The desired output would be:</p>

<pre><code>[(0, 'one', 'val1'),
 (1, 'two', 'val2'),
 (2, 'three', 'val3'),
 (3, 'four', 'val4'),
 (4, 'five', 'val5')]
</code></pre>
