Python list-of-list idioms
<p>data2['C'] is a list that looks like: </p>

<pre><code>[['20120524', '26.31'], ['20120523', '26.08'], ['20120522', '26.52'], ['20120521', '25.75']]
</code></pre>

<p>I want to write code that can iterate across d['C'][i][0] and find the list index corresponding to a specific value (a date stored as YYYYMMDD). I still find Python's for loop idioms confusing, and would like clarification on why the first block of code is invalid but the second block of code is valid. Also, if there is a built-in Python function that will do the search procedure I described, please share.</p>

<p>Doesn't work:</p>

<pre><code>&gt;&gt;&gt; print data2['C'][i][0] for i in range(len(data2['C']))
 File "&lt;stdin&gt;", line 1
   print data2['C'][i][0] for i in range(len(data2['C']))
                           ^
SyntaxError: invalid syntax
</code></pre>

<p>Works:</p>

<pre><code>&gt;&gt;&gt; for i in range(len(data2['C'])):
...     print data2['C'][i][0]
... 
20120524
20120523
20120522
20120521
</code></pre>
