install sqlite3 python
pip install pysqlite3
install sqlite3 python
pip install pysqlite3
sqlite3 python
import sqlite3 as lite
import sys
try:
con = lite.connect('products.db')
cur = con.cursor()
cur.execute("CREATE TABLE drinks(Id INTEGER PRIMARY KEY AUTOINCREMENT, Name TEXT, Price REAL)")
cur.execute("CREATE TABLE fruits(Id INTEGER PRIMARY KEY AUTOINCREMENT, Name TEXT, Price REAL)")
con.commit()
except e:
if con:
con.rollback()
print("Unexpected error %s:" % e.args[0])
sys.exit(1)
finally:
if con:
con.close()
how to install sqlite3 in python
if you are using python3, sqlite3 is built in into it.
how to install sqlite3 in python
#!/usr/bin/python
import sqlite3
conn = sqlite3.connect('test.db')
print "Opened database successfully";
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us