我就废话不多说了,大家还是直接看代码吧!
#执行结果转化为dataframe
df = pd.DataFrame(list(result))
补充知识:python pymysql注意事项
cursor.execute 与 cursor.executemany有许多不同的地方
1. execute 中字段的值是字符串形式时必须加引号,但是executemany只需要使用占位符%s,pymysql利用给的参数list自动会加上引号
2.execute返回结果都是数字,但是executemany返回结果为none和数字
3.executemany之后执行fetchall,只能返回最后一条语句执行