how to insert values into sqlite3 database by using Python?
Answers
Answered by
2
Answer:
SQLite Python: Inserting Data
First, connect to the SQLite database by creating a Connection object.
Second, create a Cursor object by calling the cursor method of the Connection object.
Third, execute an INSERT statement. If you want to pass arguments to the INSERT statement, you use the question mark (?) as the placeholder for each argument.
Explanation:
Hope it helps you
Answered by
1
import sqlite3
connection = sqlite3.connect("mydb.db")
cursor = connection.cursor()
cursor.execute("INSERT INTO x VALUES ('y', 'z')")
Similar questions