there’s a better way
# Larger example
rows = [('2006-03-28', 'BUY', 'IBM', 1000, 45.00),
('2006-04-05', 'BUY', 'MSOFT', 1000, 72.00),
('2006-04-06', 'SELL', 'IBM', 500, 53.00)]
c.executemany('insert into stocks values (?,?,?,?,?)', rows)
connection.commit()
More Related Contents:
- What is an efficient way of inserting thousands of records into an SQLite table using Django?
- Python pandas insert list into a cell
- Insert an element at a specific index in a list and return the updated list
- How can I get dict from sqlite query?
- Using a WHERE ___ IN ___ statement
- Insert element in Python list after every nth element
- How to add element in Python to the end of list using list.insert?
- TypeError: ‘float’ object is not subscriptable
- How to get a single result from a SQL query in python?
- Is this Python code vulnerable to SQL injection? (SQLite3)
- pysqlite: Placeholder substitution for column or table names?
- Python SQLite3 SQL Injection Vulnerable Code
- How to check the existence of a row in SQLite with Python?
- list extend() to index, inserting list elements not only to the end
- What does “list comprehension” and similar mean? How does it work and how can I use it?
- Iterate over all pairs of consecutive items in a list [duplicate]
- How Big can a Python List Get?
- Sum a list of numbers in Python
- Modify a list while iterating
- How do I create a list with numbers between two values?
- sqlalchemy: how to join several tables by one query?
- List assignment with [:]
- Identify if list has consecutive elements that are equal
- Python data structure sort list alphabetically
- What’s the difference between lists enclosed by square brackets and parentheses in Python?
- Difference between using [] and list() in Python
- SQLite Performance Benchmark — why is :memory: so slow…only 1.5X as fast as disk?
- Python: Elegant way to check if at least one regex in list matches a string
- How to delete a table in SQLAlchemy?
- How to extract all values from a dictionary in Python?