Fixed #25455 -- Optimized dictfetchall() example.

Thanks aklim007 for the suggestion.
This commit is contained in:
Tim Graham 2015-09-24 13:17:39 -04:00
parent ce531f7ad7
commit 361f60479d
1 changed files with 2 additions and 2 deletions

View File

@ -282,9 +282,9 @@ using something like this::
def dictfetchall(cursor):
"Return all rows from a cursor as a dict"
desc = cursor.description
columns = [col[0] for col in cursor.description]
return [
dict(zip([col[0] for col in desc], row))
dict(zip(columns, row))
for row in cursor.fetchall()
]