import sqlite3 as sql
print("1 - добавление\n2 - получение")
choice = int(input("> "))
con = sql.connect('test12.db')
with con:
cur = con.cursor()
cur.execute("CREATE TABLE IF NOT EXISTS test (name
STRING, surname
STRING)")
if choice == 1:
name = input("Имч\n")
surname = input("Фамилия\n")
cur.execute(f"INSERT INTO test VALUES ('{name}', '{surname}')")
elif choice == 2:
name1 = input("Имя /n")
cur.execute("SELECT name FROM test
")
rows = cur.fetchall()
for row in rows:
print(row)
else:
print("Вы ошиблись")
con.commit()
cur.close()
cur.execute("Select * from test where name = ?;", (name1,))