Код: Выделить всё
with sqlite3.connect("test.db") as db:
cursor = db.cursor()
cursor.execute("""CREATE TABLE IF NOT EXISTS testtable(id integer PRIMARY KEY, name text);""")
cursor.execute("""INSERT INTO testtable(id, name) VALUES (1, "XYZ")""")
db.commit()
cursor.execute("select * from testtable")
for x in cursor.fetchall():
print(x)
Однако он все равно выполняется! Я могу видеть содержимое таблицы. Что здесь происходит?
Подробнее здесь: https://stackoverflow.com/questions/790 ... -with-stat