Python - mysqlDB, sqlite result as dictionary

前端 未结 5 1524
Happy的楠姐
Happy的楠姐 2020-12-13 10:25

When I do someting like

sqlite.cursor.execute(\"SELECT * FROM foo\")
result = sqlite.cursor.fetchone()

I think have to remember the order t

5条回答
  •  北荒
    北荒 (楼主)
    2020-12-13 10:40

    Doing this in mysqlDB you just add the following to the connect function call

    cursorclass = MySQLdb.cursors.DictCursor
    

提交回复
热议问题