Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- # Script para administrar una base
- import sqlite3
- conn = sqlite3.connect("productos.db")
- cursor = conn.cursor()
- def menu():
- return f"""
- Menu de administración de ....
- ------------------------------
- 1. Agregar registro
- 2. Ver registros
- 3. Borrar registros
- 4. Modificar registros
- 5. Salir
- ------------------------------
- """
- while True:
- print(menu())
- opcion = input("Seleccione su opción: ")
- if opcion == "1":
- nombre = input("Nombre: ")
- edad = int(input("Edad: "))
- cursor.execute("INSERT INTO Personas VALUES(?,?)",(nombre, edad))
- conn.commit()
- elif opcion == "2":
- pass
- elif opcion == "3":
- pass
- elif opcion == "4":
- pass
- elif opcion == "4":
- print("Cerrando conexiòn con la base...")
- conn.close()
- break
- else:
- print("Opción incorrecta...")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement