title: How to retrieve SQL result column value using column name in Python using MySql data base?
body: <p>Is there a way to retrieve SQL result column value using column name instead of column index in Python?</p>
  
  <pre><code>result = `select name, deptname from employee;`
  </code></pre>
  
  <p>I tried below one:</p>
  
  <pre><code>cursor = conn.cursor(MySQLdb.cursors.DictCursor)
  cursor.execute("SELECT name, category FROM animal")
  result_set = cursor.fetchall()
  for row in result_set:
      print "%s, %s" % (row["name"], row["deptname"])
  </code></pre>
  
  <p>Here I got an error like:</p>
  
  <pre><code>TypeError: tuple indices must be integers, not str
  </code></pre>
  
  <p>Any help will be awesome?</p>