con = pymysql.connect(host=, port=3306, user=, password=, db=)
cursor = self.con.cursor()
sql = 'INSERT INTO chongqing_zaobiao(title,pub_date,province,city,district,url,web) VALUES (%s,%s,%s,%s,%s,%s,%s)'
cursor.execute(sql,[参数值])
con.commit()#执行
cursor.close()#关闭
连接数据库并插入数据
最新推荐文章于 2022-12-05 16:56:00 发布