How to generate html file from sqlite3 database using SmileyDB3

PHOTO EMBED

Wed Aug 14 2024 17:14:46 GMT+0000 (Coordinated Universal Time)

Saved by @freepythoncode ##python #coding #python #programming #database #sqllite3 #image #smileydb3

from faker import Faker
from SmileyDB3 import SmileyDB3
from random import randint

import webbrowser

f = Faker()
db = SmileyDB3('mydb.db')

users = db.table('users')

for i in range(20):
    users.Insert(data={
        'name': f.name(),
        'email': f.email(),
        'age': randint(20, 40)
    })

users.convert().to_html('out.html')

webbrowser.open('out.html')
content_copyCOPY