Skip to content

Instantly share code, notes, and snippets.

@StephenFordham
Created May 8, 2019 18:43
Show Gist options
  • Save StephenFordham/8f31427c195cf9cfcb24cb27b736b689 to your computer and use it in GitHub Desktop.
Save StephenFordham/8f31427c195cf9cfcb24cb27b736b689 to your computer and use it in GitHub Desktop.
insert_into
del fList[0]
rows = ''
for i in range(len(fList)-1):
rows += "('{}','{}','{}','{}','{}','{}','{}','{}','{}','{}')"\
.format(fList[i][0], fList[i][1], fList[i][2], fList[i][3], fList[i][4],
fList[i][5], fList[i][6], fList[i][7], fList[i][8], fList[i][9])
if i != len(fList)-2:
rows += ','
print(rows)
queryInsert = "INSERT INTO FOOTBALL VALUES" + rows
cursor.execute(queryInsert)
mydb.commit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment