-
-
Save parzibyte/ab78cd2d6d1287f6ab22559c5745c321 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlite3 | |
try: | |
bd = sqlite3.connect("libros.db") | |
cursor = bd.cursor() | |
autor = input("\nAutor: ") | |
genero = input("\nGénero: ") | |
precio = float(input("\nPrecio: ")) | |
titulo = input("\nTítulo: ") | |
sentencia = "INSERT INTO libros(autor, genero, precio, titulo) VALUES (?,?,?,?)" | |
cursor.execute(sentencia, [autor, genero, precio, titulo]) | |
bd.commit() | |
print("Guardado correctamente") | |
except sqlite3.OperationalError as error: | |
print("Error al abrir:", error) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment