美文网首页
Insert_the_logic_two

Insert_the_logic_two

作者: 月夜星空下 | 来源:发表于2020-05-13 16:46 被阅读0次
    import time
    import pymysql
    import mysql.connector
    from plan2 import The_original_title, all_one_middle, td
    # td = input("请输入栏目编号(1-4):")
    i = 0
    
    for tit, cet in zip(The_original_title, all_one_middle):
        i += 1
        print(tit, cet)
        link = pymysql.Connect(host='localhost', port=3306, user='root', password='yz1028959', db='dede', 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(%s, 1, 1,%s, 1, 0, 1)'
        archives = cursor.execute(sql, tdtt, )
        # archives = cursor.execute(sql)
        # print('2')
        sql = 'INSERT INTO dede_arctiny(typeid, channel, mid) VALUES (%s, 1, 1)' % td
        arctiny = cursor.execute(sql)
        # print('3')
        cursor.close()
        link.close()
        print("~成功执行~", i)
    print("sucessfully!")
    

    相关文章

      网友评论

          本文标题:Insert_the_logic_two

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