1 Star 0 Fork 0

akira / historybook

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
todo.py 588 Bytes
一键复制 编辑 原始数据 按行查看 历史
akira 提交于 2022-06-17 06:05 . update todo.py.
import os, sys
import MySQLdb
from Tools.scripts.make_ctype import values
try:
conn=MySQLdb.connect(host="localhost",user="root",passwd="",db="address"
except Exception as e:
print( e)
sys.exit()
cursor=conn.cursor()
sql="insert into address(name, address) values(%s, %s)"
value=(("zhangsan","haidian"),("lisi","haidian"))
try:
cursor.executemany(sql,values)
except Exception as e:
print (e)
sql="select * from address"
cursor.execute(sql)
data=cursor.fetchall()
if data:
for x in data:
print (x[0],x[1])
cursor.close()
conn.close()
Python
1
https://gitee.com/idart/historybook.git
git@gitee.com:idart/historybook.git
idart
historybook
historybook
master

搜索帮助