-
-
Save parzibyte/685ecf804eef32c80e8788e691a7e87d 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() | |
tablas = [ | |
""" | |
CREATE TABLE IF NOT EXISTS libros( | |
autor TEXT NOT NULL, | |
genero TEXT NOT NULL, | |
precio REAL NOT NULL, | |
titulo REAL NOT NULL | |
); | |
""" | |
] | |
for tabla in tablas: | |
cursor.execute(tabla); | |
print("Tablas creadas 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