Created
December 13, 2016 13:42
-
-
Save KennethanCeyer/e6b29ab77204744966b0f4bb6a4f63f6 to your computer and use it in GitHub Desktop.
Inconvenience things of python.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this is only for examination. | |
query = "SELECT * from information_schema.tables" | |
cursor.execute(query) | |
# why we must use those logic more. | |
columns = cursor.description | |
result = [] | |
for value in cursor.fetchall(): | |
tmp = {} | |
for (index, column) in enumerate(value): | |
tmp[columns[index][0]] = column | |
result.append(tmp) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment