2016-04-20 3 views

Antwort

0

Ich habe eine Methode gefunden, dies zu tun. Im Folgenden finden Sie der entsprechende Code-Schnipsel:

column_name = [column1,column2,column3] 
for row in cur: 
     list_row = list(row) # convert the tuple row to a list type. 
     final = zip(column_names,list_row) # zip the two lists. 
     dict_final = dict(final) # Convert the resulting final list to a dictionary. 

Ich weiß nicht, ob es ein besserer Weg, dies zu tun, aber das ist, was ich kam mit.