Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
25 lines (20 loc) · 798 Bytes

File metadata and controls

25 lines (20 loc) · 798 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# add_data.py
import sqlite3
conn = sqlite3.connect("books.db")
cursor = conn.cursor()
# insert a record into the database
cursor.execute("""INSERT INTO books
VALUES ('Python 101', 'Mike Driscoll', '9/01/2020',
'Mouse Vs Python', 'epub')"""
)
# save data to database
conn.commit()
# insert multiple records using the more secure "?" method
books = [('Python Interviews', 'Mike Driscoll',
'2/1/2018', 'Packt Publishing', 'softcover'),
('Automate the Boring Stuff with Python',
'Al Sweigart', '', 'No Starch Press', 'PDF'),
('The Well-Grounded Python Developer',
'Doug Farrell', '2020', 'Manning', 'Kindle')]
cursor.executemany("INSERT INTO books VALUES (?,?,?,?,?)", books)
conn.commit()
Morty Proxy This is a proxified and sanitized view of the page, visit original site.