Home ยป Python query SQlite database example

Python query SQlite database example

by shedboy71

In this example we use the database we created in the create database example and we will simply display all rows in the database

[codesyntax lang=”python”]

#!/usr/bin/python

import sqlite3 as lite
import sys


con = lite.connect('test.db')

with con: 

cur = con.cursor() 
cur.execute("SELECT * FROM Jobs")

rows = cur.fetchall()

for row in rows:
print (row)

[/codesyntax]

 

You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More