Advertisement
teslariu

bases relacionales

Aug 24th, 2023 (edited)
1,216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. # preparo datos
  2. personas = (
  3.     ('Pablo', 34),
  4.     ("Juan", 23),
  5.     ("Ana",44)
  6. )
  7.  
  8. # agrego datos a la tabla
  9. for nombre, edad in personas:
  10.     cursor.execute("INSERT INTO personas VALUES(?,?)",(nombre,edad))
  11. conn.commit()
  12.  
  13. # leo los datos de la tabla y los imprimo
  14. cursor.execute("SELECT * FROM personas")
  15. datos = cursor.fetchall()
  16. print(personas)
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement