美文网首页
Insert_the_logic_one

Insert_the_logic_one

作者: 月夜星空下 | 来源:发表于2020-05-13 16:45 被阅读0次
import time
import pymysql
import mysql.connector
from plan_one import all_rand_title, all_one_middle
td = input("请输入栏目编号(1-4):")
i = 0
# all_rand_title = ['一1', '二2', '三3', '四4']
# all_one_middle = ['111', '222', '333', '444']
for tit, cet in zip(all_rand_title, all_one_middle):
    i += 1
    print(tit, cet)
    link = pymysql.Connect(host='localhost', port=3306, user='root', password='yz1028959', db='dede1', charset='utf8')
    cursor = link.cursor()
    print("~~~连接正常~~~", i)
    data = (td, cet)
    tdtt = (td, tit)
    sql = 'INSERT INTO dede_addonarticle(typeid, body) VALUES (%s,%s)'
    addonarticle = cursor.execute(sql, data, )
    # print('1')
    sql = 'INSERT INTO dede_archives(typeid, ismake, channel, title, mid, voteid, dutyadmin) VALUES(4, 1, 1,"%s", 1, 0, 1)'% tit
    # archives = cursor.execute(sql, tdtt, )
    archives = cursor.execute(sql)
    # print('2')
    sql = 'INSERT INTO dede_arctiny(typeid, channel, mid) VALUES (4, 1, 1)'
    arctiny = cursor.execute(sql)
    # print('3')
    cursor.close()
    link.close()
    print("~成功执行~", i)
print("sucessfully!")

网友评论

      本文标题:Insert_the_logic_one

      本文链接:https://www.haomeiwen.com/subject/xixonhtx.html