Answers for "python write to sqlite"

0

python create sqlite db file

import sqlite3
from sqlite3 import Error


def create_connection(db_file):
    """ create a database connection to a SQLite database """
    conn = None
    try:
        conn = sqlite3.connect(db_file)
        print(sqlite3.version)
    except Error as e:
        print(e)
    finally:
        if conn:
            conn.close()


if __name__ == '__main__':
    create_connection(r"C:sqlitedbpythonsqlite.db")
Code language: Python (python)
Posted by: Guest on January-09-2022

Python Answers by Framework

Browse Popular Code Answers by Language