数据库支持:

数据库API

连接数据库:导入不同的针对不同数据库的模块,然后使用模块.connect(),如mysql则是MySQLdb.connect(localhost,uid,pwd)

通过连接句柄建立游标:conn.cursor()

向数据库发送命令:cursor.execute(“set names gbk”)

取出第一条记录:cursor.fetchone()

取出全部:cursor.fetchall()

取出多条:cursor.fetchmany()

cursor的属性rowcount,行数统计

cursor.close()#关闭游标

conn.close()#关闭连接

相关文章:

  • 2021-12-14
  • 2022-12-23
  • 2021-09-02
  • 2022-12-23
  • 2021-11-05
猜你喜欢
  • 2021-06-23
  • 2021-10-15
  • 2021-08-29
  • 2021-10-26
  • 2022-01-01
  • 2022-02-19
相关资源
相似解决方案