mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
gh-96121: Merge sqlite3.Row examples into sqlite3.Row class doc (#96122)
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com> Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
This commit is contained in:
parent
53e6a9a725
commit
18b1782192
2 changed files with 18 additions and 70 deletions
|
|
@ -1,14 +0,0 @@
|
|||
import sqlite3
|
||||
|
||||
con = sqlite3.connect(":memory:")
|
||||
con.row_factory = sqlite3.Row
|
||||
|
||||
cur = con.cursor()
|
||||
cur.execute("select 'John' as name, 42 as age")
|
||||
for row in cur:
|
||||
assert row[0] == row["name"]
|
||||
assert row["name"] == row["nAmE"]
|
||||
assert row[1] == row["age"]
|
||||
assert row[1] == row["AgE"]
|
||||
|
||||
con.close()
|
||||
Loading…
Add table
Add a link
Reference in a new issue