python数据库

来源:互联网 发布:最霸气的纹身 知乎 编辑:程序博客网 时间:2024/05/16 11:01

sqlite3

sqlite = sqlite3.connect('/root/test.db') #里边要数据库的文件路径cxn = MySQLdb.connect(user='root',passwd='root',db='hei_admin') |  close(...) |      Closes the connection. |   |  commit(...) |      Commit the current transaction. |  cursor(...) |      Return a cursor for the connection. |   |  execute(...) |      Executes a SQL statement. Non-standard. |   |  executemany(...) |      Repeatedly executes a SQL statement. Non-standard. |   |  executescript(...) |      Executes a multiple SQL statements at once. Non-standard. |   |  rollback(...) |      Roll back the current transaction.execute() 执行一个语句executemany() 执行一组语句fetchone()fetchmany()fetchall()close()next() 相当于fetchonelastrowidrowcountarraysize
0 0
原创粉丝点击