I have 8 kinds of data that I would like to insert into a mysql table through mysql-connector using python.
I have looked at some documents saying that it is better to use
Antti Haapala has a great answer but you could also tidy it up by using zip
to build the row to insert for you
for row in zip(URL, Title, Content, Month, Date, Year, Time1, TimeZone):
dbcur.execute(
"""INSERT INTO scripting (URL, Title, Content, Month, Date, Year, Time, TimeZone)
VALUES ("%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s")""",
row)
dbcon.commit()