c =

c = self.db.cursor(cursorclass=MySQLdb.cursors.DictCursor)
c.execute(query)
rows = c.fetchall()

That works perfectly to get associate arrays and you don't have to switch database objects, just change your cursor when you need associative arrays.

Spechal (not verified) – Fri, 2009 – 11 – 27 08:43

Reply

Please solve the math problem above and type in the result. e.g. for 1+1, type 2
The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
More information about formatting options