擅长:python、mysql、java
<p>你在找<a href="https://docs.python.org/2/library/csv.html#csv.DictReader" rel="noreferrer">DictReader</a></p>
<pre><code>with open('info.csv') as f:
reader = csv.DictReader(f, delimiter=';')
for row in reader:
name = row['name']
blah = row['blah']
</code></pre>
<p>引用链接:</p>
<blockquote>
<p>Create an object which operates like a regular reader but maps the
information read into a dict whose keys are given by the optional
fieldnames parameter.
...
If the fieldnames parameter is omitted, the values in the first row of
the csvfile will be used as the fieldnames.</p>
</blockquote>