summaryrefslogtreecommitdiffstats
path: root/Doc/lib/sqlite3/insert_more_people.py
blob: 7daa88bd4c624c1ef32030682f3c71476a944eae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import sqlite3

con = sqlite3.connect("mydb")

cur = con.cursor()

newPeople = (
    ('Lebed'       , 53),
    ('Zhirinovsky' , 57),
  )

for person in newPeople:
    cur.execute("insert into people (name_last, age) values (?, ?)", person)

# The changes will not be saved unless the transaction is committed explicitly:

con.commit()