SHARE
TWEET

Untitled

a guest Jun 17th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python
  2.  
  3. import sqlite3
  4.  
  5. def main():
  6.     conn = sqlite3.connect('example.db')
  7.     c = conn.cursor()
  8.  
  9.     # Create table
  10.     c.execute('''CREATE TABLE example
  11.                  (key text)''')
  12.  
  13.     # Larger example that inserts many records at a time
  14.     data = ['first','then','finally']
  15.     c.executemany('INSERT INTO example(key) VALUES (?)', zip(data))
  16.  
  17.     for row in c.execute('SELECT * FROM example ORDER BY key'):
  18.         print(row)
  19.  
  20. if __name__ == '__main__':
  21.     main()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top