Answer the question
In order to leave comments, you need to log in
Records are not being added to SQLite, what is the reason for this?
Hello!
I'm trying to connect a table to a Python program in order to add data through it, but for some reason it works without errors, although data is not added, here is a code snippet:
connection = sqlite3.connect('bd/teachers.db')
teachers = connection.cursor()
name = str(input('Имя\n'))
about = str(input('Описание\n'))
table = str(input('таблица\n'))
ins = 'INSERT INTO {} VALUES(NULL,?,?,?)'.format(table)
print(ins)
teachers.execute(ins, (name, about, des))
Answer the question
In order to leave comments, you need to log in
First, you can specify which fields you insert
Secondly, the data will not be saved to the database unless the transaction is committed by calling the commit method .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question