def dictfetchall(cursor): columns = [col[0] for col in cursor.description] return [ dict(zip(columns, row)) for row in cursor.fetchall() ]
python cursor结果转为带有索引的结果集
最新推荐文章于 2024-08-30 13:41:02 发布
def dictfetchall(cursor): columns = [col[0] for col in cursor.description] return [ dict(zip(columns, row)) for row in cursor.fetchall() ]