import pymysql#Connect to the databaseconn = pymysql.connect(host='localhost',port=3306,user='root',passwd='123456',db='test',charset='utf8',)cursor = conn.cursor()f = open('C:\\Users\\zyl\\Desktop\\new folder\\shangweiwenjian.txt', "r",encoding = 'utf-8')while True:# read line by lineline = f.readlines()if line:# process each line\nline = "".join(line)line = line.strip('\n')line = line.split(",")content = line[0]cursor.execute("insert into article(content_detail) values(%s)",[content])else:breakf.close()cursor.close()conn.commit()conn.close()