Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created July 2, 2019 23:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/685ecf804eef32c80e8788e691a7e87d to your computer and use it in GitHub Desktop.
Save parzibyte/685ecf804eef32c80e8788e691a7e87d to your computer and use it in GitHub Desktop.
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