diff options
| author | Erlend Egeberg Aasland <erlend.aasland@innova.no> | 2021-05-19 07:41:19 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-19 07:41:19 (GMT) |
| commit | 92d1064727d6b7f4136f9c09ab52ae15e3676afe (patch) | |
| tree | ae8bf88ce5406adf0d8fc2f0f64f8b20de077142 /Doc/includes/sqlite3/shortcut_methods.py | |
| parent | 901443757333a66ff2b5c85eba30dc1c48eac321 (diff) | |
| download | cpython-92d1064727d6b7f4136f9c09ab52ae15e3676afe.zip cpython-92d1064727d6b7f4136f9c09ab52ae15e3676afe.tar.gz cpython-92d1064727d6b7f4136f9c09ab52ae15e3676afe.tar.bz2 | |
bpo-44106: Improve sqlite3 example database contents (GH-26027)
Diffstat (limited to 'Doc/includes/sqlite3/shortcut_methods.py')
| -rw-r--r-- | Doc/includes/sqlite3/shortcut_methods.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Doc/includes/sqlite3/shortcut_methods.py b/Doc/includes/sqlite3/shortcut_methods.py index 98a3941..48ea6fa 100644 --- a/Doc/includes/sqlite3/shortcut_methods.py +++ b/Doc/includes/sqlite3/shortcut_methods.py @@ -1,23 +1,23 @@ import sqlite3 -persons = [ - ("Hugo", "Boss"), - ("Calvin", "Klein") - ] +langs = [ + ("C++", 1985), + ("Objective-C", 1984), +] con = sqlite3.connect(":memory:") # Create the table -con.execute("create table person(firstname, lastname)") +con.execute("create table lang(name, first_appeared)") # Fill the table -con.executemany("insert into person(firstname, lastname) values (?, ?)", persons) +con.executemany("insert into lang(name, first_appeared) values (?, ?)", langs) # Print the table contents -for row in con.execute("select firstname, lastname from person"): +for row in con.execute("select name, first_appeared from lang"): print(row) -print("I just deleted", con.execute("delete from person").rowcount, "rows") +print("I just deleted", con.execute("delete from lang").rowcount, "rows") # close is not a shortcut method and it's not called automatically, # so the connection object should be closed manually |
