Staging
v0.5.1
https://github.com/python/cpython
Raw File
Tip revision: bd18254b91272c2f0f0d98f66fdeca962ef1a901 authored by Ned Deily on 11 December 2019, 05:24:09 UTC
3.7.6rc1
Tip revision: bd18254
execsql_printall_1.py
import sqlite3

# Create a connection to the database file "mydb":
con = sqlite3.connect("mydb")

# Get a Cursor object that operates in the context of Connection con:
cur = con.cursor()

# Execute the SELECT statement:
cur.execute("select * from people order by age")

# Retrieve all rows as a sequence and print that sequence:
print(cur.fetchall())

con.close()
back to top