try #inserting the values into the table cur execute(sql,val #commit the transaction myconn commit( except myconn rollback( print(cur rowcount,"record inserted!" myconn close(fig insert operation output insert multiple rows we can also insert multiple rows at once using the python script the multiple rows are mentioned as the list of various tuples each element of the list is treated as one particular rowwhereas each element of the tuple is treated as one particular column value (attributeimport mysql connector