conn = pymysql.connect(host="127.0.0.1", port=3306, user="root", password="root", database="mydatabase", charset="utf8")
cur = conn.cursor(cursor=pymysql.cursors.DictCursor)#添加cursor=pymysql.cursors.DictCursor,查询返回字典
标签:cur,python,sql,pymysql,cursor,cursors,mysql,连接,conn From: https://www.cnblogs.com/dyjnicole/p/17197832.html
sql = "insert into admin(username,password,mobile) values ('dengyajuan','123456','15026770001');"
cur.execute(sql) # 执行
# cur.fetchall(sql) # 查询
conn.commit()
cur.close()
conn.close()