Advertisement
teslariu

Untitled

Nov 15th, 2020
84
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import sqlite3
  4. conn = sqlite3.connect("database_1.sqlite")
  5. cursor = conn.cursor()
  6.  
  7. cursor.execute("CREATE TABLE personas (nombre TEXT, edad NUMERIC)")
  8. conn.commit()
  9.  
  10. Personas_content = (
  11.     ("Pablo", 30),
  12.     ("Jorge", 41),
  13.     ("Pedro", 27)
  14. )
  15. for nombre, edad in Personas_content:
  16.     cursor.execute("INSERT INTO personas VALUES (?, ?)", (nombre, edad))
  17.    
  18. conn.commit()
Advertisement
RAW Paste Data Copied
Advertisement