MySQLdb has a separate cursor class for this, the DictCursor. You can pass the cursor class you want to use to MySQLdb.connect():
import MySQLdb.cursors
MySQLdb.connect(host="...", cursorclass=MySQLdb.cursors.DictCursor)
More Related Contents:
- How do I merge two dictionaries in a single expression (take union of dictionaries)?
- Iterating over dictionaries using ‘for’ loops
- Delete an element from a dictionary
- PyInstaller, spec file, ImportError: No module named ‘blah’
- How to merge multiple dicts with same key or different key?
- Rename a dictionary key
- Modifying a Python dict while iterating over it
- Safe method to get value of nested dictionary
- How to convert an XML string to a dictionary?
- How to sum dict elements
- Extract subset of key-value pairs from dictionary?
- How does the key argument in python’s sorted function work?
- Enable Python to Connect to MySQL via SSH Tunnelling
- Convert a python dict to a string and back
- How do I escape % from python mysql query
- sort dict by value python [duplicate]
- Is there anything faster than dict()?
- Remove an item from a dictionary when its key is unknown
- Using Django database layer outside of Django?
- Python: Elegantly merge dictionaries with sum() of values [duplicate]
- Efficient way to remove keys with empty strings from a dict
- How to convert a list to a dictionary with indexes as values?
- “unpacking” a passed dictionary into the function’s name space in Python?
- How to detect if any element in a dictionary changes?
- Python Pickling Dictionary EOFError
- Is the order of a Python dictionary guaranteed over iterations?
- Know the depth of a dictionary
- How to extract all values from a dictionary in Python?
- Determine whether a key is present in a dictionary [duplicate]
- Comparing 2 lists consisting of dictionaries with unique keys in python