Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- import sqlite3
- conn = sqlite3.connect("productos.sqlite")
- cursor = conn.cursor()
- cursor.execute("CREATE TABLE productos (codigo NUMERIC, nombre TEXT, precio NUMERIC)")
- conn.commit()
- datos = (
- (1,"Teclado",1500),
- (2,"Mouse",600),
- (3,"Motherboard",15000),
- (4,"Parlantes",3900)
- )
- for codigo, nombre, precio in datos:
- cursor.execute("INSERT INTO productos VALUES (?,?,?)",(codigo, nombre, precio))
- conn.commit()
- conn.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement