| 1 | import sqlite3 |
| 2 | |
| 3 | con = sqlite3.connect("mydb") |
| 4 | |
| 5 | cur = con.cursor() |
| 6 | |
| 7 | newPeople = ( |
| 8 | ('Lebed' , 53), |
| 9 | ('Zhirinovsky' , 57), |
| 10 | ) |
| 11 | |
| 12 | for person in newPeople: |
| 13 | cur.execute("insert into people (name_last, age) values (?, ?)", person) |
| 14 | |
| 15 | # The changes will not be saved unless the transaction is committed explicitly: |
| 16 | con.commit() |