MySQL python DBAPI.如何获得字典而不是元组?

Ste*_*ini 5 python mysql python-db-api

在执行的游标上调用fetchall时,Python DB API返回元组列表.如果您使用_mysql模块,fetch_row有一个how参数,允许获取字典而不是元组.如何用光标实现同样的效果?

And*_*lke 4

引用自文档

DictCursor
    Like Cursor except it returns rows as dictionaries.
Run Code Online (Sandbox Code Playgroud)