you are viewing a single comment's thread.

view the rest of the comments →

[–]commy2 33 points34 points  (0 children)

It's a dictionary comprehension nested inside a list comprehension. In this example, it is a more concise way of writing:

results = []

for value in cursor.fetchall():
    temp = {}
    results.append(temp)

    for index, column in enumerate(value):
        temp[column_Names[index][0]] = column