# 建立数据库连接,剔除已入库的部分
db = pymysql.connect(host='127.0.0.1', user='root', passwd='', db='test', charset='utf8')
cursor = db.cursor()dt = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
sql_insert = "INSERT INTO bn_content(content,create_time) VALUES ('%s','%s')" %(text,dt)
cursor.execute(sql_insert)
db.commit()