查询数据

conn = connect(host,port,user,password,charset)

创建cursor对象
cs1 = conn.cursor()

通过execute执行sql语句
count = cs1.execute(’…’)

往外取数据
cs1.fetchmany()
cs1.fetchall()
cs1.fetchone()

关闭Cursor对象
cs1.close()
conn.close()

此处的重点是,通过execute执行sql语句后,将取出来的数据存入Cursor中,第一次使用cursor.fetchall()取出来后,再取就没有了。。。
python操作数据库MySQL

python操作数据库MySQL

相关文章:

  • 2021-12-20
  • 2021-09-24
  • 2021-09-24
  • 2021-09-02
  • 2021-06-11
  • 2021-12-17
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-01
  • 2021-11-21
  • 2021-08-20
  • 2021-06-05
  • 2021-12-20
相关资源
相似解决方案