元组转换为字典
import pymysql
from collections import defaultdict
conn = pymysql.connect(host='*', user='*', password="*", database='*')
cur = conn.cursor()
cur.execute('select * from t5')
ret = cur.fetchall()
print(ret)
dic = defaultdict(list)
for i in range(len(ret)):
dic[ret[i][0]].append(ret[i][1])
for key in dic:
print(dic[key])