티스토리 뷰


import sqlite3
 
conn = sqlite3.connect("test.db")
 
cur = conn.cursor()
sql = "select * from customer where category=? and region=?"
cur.execute(sql, (1, 'SEA'))
rows = cur.fetchall()
for row in rows:
    print(row)
 
conn.close()



#Named

sql = "select * from customer where id = :Id"
cur.execute(sql, {"Id": 1})


'programming > python' 카테고리의 다른 글

python sqlite3 심플 예제  (0) 2018.08.31
db 기본 문법  (0) 2018.08.31
python sqlite3  (0) 2018.08.26
[Flask] sqlite3 사용예제  (0) 2018.08.26
[Flask] url_for  (0) 2018.08.25
Comments