title: query from postgresql using python as dictionary
body: <p>I'm using Python 2.7 and postgresql 9.1. 
  Trying to get dictionary from query, I've tried the code as described here:
  <a href="http://wiki.postgresql.org/wiki/Using_psycopg2_with_PostgreSQL">http://wiki.postgresql.org/wiki/Using_psycopg2_with_PostgreSQL</a></p>
  
  <pre><code>import psycopg2
  import psycopg2.extras
  conn = psycopg2.connect("dbname=mydb host=localhost user=user password=password")
  cur = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
  cur.execute ("select * from port")
  type(cur.fetchall())
  </code></pre>
  
  <p>It is printing the next answer:</p>
  
  <pre><code>&lt;type 'list'&gt;
  </code></pre>
  
  <p>printing the item itself, show me that it is list.
  The excepted answer was dictionary.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>Trying the next:</p>
  
  <pre><code>ans = cur.fetchall()[0]
  print ans
  print type(ans)
  </code></pre>
  
  <p>returns </p>
  
  <pre><code>[288, 'T', 51, 1, 1, '192.168.39.188']
  &lt;type 'list'&gt;
  </code></pre>