Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
from flask import Flask
from flask import render_template
import sqlite3
app = Flask(__name__)
@app.route('/books')
def books():
con = sqlite3.connect('database.db')
try:
con.execute('CREATE TABLE books (isbn PRIMARY KEY INT,name TEXT, price INT, date TEXT, trade_price REAL, image TEXT )')
print ('Table created successfully');
except:
pass
con.close()
con = sqlite3.connect("database.db")
con.row_factory = sqlite3.Row
cur = con.cursor()
cur.execute("SELECT * from books")
rows = cur.fetchall();
return render_template("books.html", rows = rows)