import time import dataset import os import codecs db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/hhh?charset=utf8mb4') table=db['kw_contentgap'] fr=codecs.open('C:\\gitlab\\kw_tools\\kw_tools\\hhh\\SEO\\contentgap.txt','r','utf-8') lines=fr.readlines() lst=[] for l in lines: table.insert({'kw':l.replace('\n','')}) db.commit() #table=db['counter'] #table.insert({'cnt':0})