开发者

MySQL python DBAPI. How to get a dictionary instead of a tuple?

开发者 https://www.devze.com 2023-02-04 19:36 出处:网络
Python DB API returns a list of tuples when fetchall is invoked on an executed cursor. If you work with the _mysql module, fet开发者_开发知识库ch_row has a how parameter that allows to get a dictionar

Python DB API returns a list of tuples when fetchall is invoked on an executed cursor. If you work with the _mysql module, fet开发者_开发知识库ch_row has a how parameter that allows to get a dictionary instead of a tuple. How can I achieve the same with the cursor ?


Quoting from the documentation

DictCursor
    Like Cursor except it returns rows as dictionaries.
0

精彩评论

暂无评论...
验证码 换一张
取 消