python操作数据库

不写BUG 1年前 ⋅ 1581 阅读
pymysql.connect(host='127.0.0.1',user='root',password='123456',database='test',charset='utf8')
neicur = nei.cursor()
neicur.execute('select * from ***')
datas=neicur.fetchall()
fetchone()获取一条
# 获取插入的ID
cur.lastrowid