#!/usr/bin/env python
# --coding = utf-8
# Author Allen Lee
import pymysql
#创建链接对象
conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd='123', db='Allen')
#创建游标
cursor = conn.cursor()
#执行sql,更新单条数据,并返回受影响行数
effect_row = cursor.execute("update hosts set host = '1.1.1.2'")
#插入多条,并返回受影响的函数
effect_row = cursor.executemany(
python操作mysql数据库
最新推荐文章于 2023-05-23 10:55:02 发布