Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import sqlite3
- def main():
- conn = sqlite3.connect('example.db')
- c = conn.cursor()
- # Create table
- c.execute('''CREATE TABLE example
- (key text)''')
- # Larger example that inserts many records at a time
- data = ['first','then','finally']
- c.executemany('INSERT INTO example(key) VALUES (?)', zip(data))
- for row in c.execute('SELECT * FROM example ORDER BY key'):
- print(row)
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement