- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsqlite3CheetSet.py
More file actions
Latest commit
26 lines (20 loc) · 708 Bytes
/
Copy pathsqlite3CheetSet.py
File metadata and controls
26 lines (20 loc) · 708 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/python3
importsqlite3
conexion=sqlite3.connect("BaseDatosContactos.db")
cursor=conexion.cursor()
#|crea una tabla|
#cursor.execute("CREATE TABLE contactos (nombre VARCHAR(50),edad INTEGER, fecha_Nacimiento INTEGER)")
#|inserta informacion|
#cursor.execute("INSERT INTO contactos VALUES ('jose',53,23051997)")
#|devolviendo informacion|
#cursor.execute("SELECT * FROM contactos")
#informacion=cursor.fetchone() #primer fila|tipo tupla
#informacion=cursor.fetchall() #tabla completa|tipo lista
#|multliple|
#varios=[
# ("pablo",43,24101987),
# ("raul",23,17081997)]
#cursor.executemany("INSERT INTO contactos VALUES (?,?,?)", varios)
#aplicamos los cambios
conexion.commit()
conexion.close()