Python 3 - How to return all rows as a dict using csv?
<p>Listed below is my code to read rows and return one row based on the key value (a specific column i.e. player). How do I return the rest of records?</p>

<pre><code>with open('Players.csv', 'rt') as f:
    reader = csv.DictReader(f)
    for row in reader:
        key = row.pop('PLAYER') #this is my key column
        if key in result:
            pass
        result[key] = row

print (result) #printd (Player and all attributes)
</code></pre>

<p>you can try to look at<code>row.keys()</code> and <code>row.items()</code></p>

python python-3.x csv