Pymysql 使用
import pymysql
db = pymysql.connect(
host = 'localhost',
user = 'root',
password = '20150813',
db = 'db1',
charset = 'utf8'
)
cursor = db.cursor()
#执行sql语句
cursor.execute('select * from user where id = %s', (1,))
print(cursor.fetchall()
原创
2020-09-19 00:43:30 ·
143 阅读 ·
0 评论