1.pymysql安装
window命令行使用pip安装:pip install pymysql
2.mysql写入
引入开发包
import pymysql.cursors
获取数据库连接
connection = pymysql.connect(host='localhost',
user='root',
password='123456',
db='news',
charset='utf8mb4')
获取会话指针
connection.cursor()