import dataset db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4') table=db['seo_nton_custurl'] cust = "The Icons_EN" with open("list.txt", "r") as file: for line in file: if line != "": url = line.replace('\n', '') table.insert({'cust':cust,'url':url}) else: print("Empty data")