I'm new to python, so I want to know how to store the data in a database!
For a sample example, I want to store informations about users :
ent1 = input('Enter your name: ')
ent2 = input('Enter your adress: ')
ent3 = int(input('Enter your number phone: '))
sqllite3 library to perform SQL
insert query to insert data into database. For example
import sqlite3 conn = sqlite3.connect('user.db') ## Create table. Skip if table already exists conn.execute('''CREATE TABLE IF NOT EXISTS users (name TEXT NOT NULL, adress TEXT, number_phone TEXT);''') ent1 = input('Enter your name: ') ent2 = input('Enter your adress: ') ent3 = int(input('Enter your number phone: ')) #Insert into users table conn.execute("INSERT INTO users (name,adress,number_phone) \ VALUES (?,?,?)",[ent1,ent2,ent3]); conn.commit() #don't forget commit to save data conn.close()
You can also have a look at the official documentation for detailed info and API references.