23 lines
765 B
Python
23 lines
765 B
Python
import sqlite3, os
|
|
|
|
class db_work:
|
|
def __init__(self,db_file = str ) -> None:
|
|
self.db_file = db_file
|
|
def create_db(self):
|
|
with sqlite3.connect(self.db_file) as con_db:
|
|
cursor = con_db.cursor()
|
|
sql_code = '''
|
|
CREATE TABLE IF NOT EXISTS eggs(
|
|
cooler_typ TEXT,
|
|
glückszahl INTEGER
|
|
);
|
|
'''
|
|
cursor.execute(sql_code)
|
|
con_db.commit()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
script_folder = os.path.dirname(os.path.realpath(__file__))
|
|
db_file_full = script_folder + os.sep + "spam.db"
|
|
my_db = db_work(db_file=db_file_full)
|
|
my_db.create_db() |