Created
January 30, 2013 12:42
-
-
Save fmasanori/4673029 to your computer and use it in GitHub Desktop.
Banco de Dados com sqlite3
This file contains hidden or 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 | |
con = sqlite3.connect('alunos.bd') | |
cur = con.cursor() | |
cur.execute('create table alunos(login varchar(8), ra integer)') | |
cur.execute('insert into alunos values("fmasanori", 42)') | |
cur.execute('insert into alunos values("emengarda", 666)') | |
cur.execute('select * from alunos') | |
for x in cur.fetchall(): | |
print (x) | |
cur.close() | |
con.commit() | |
con.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment