Skip to content

Instantly share code, notes, and snippets.

@fmasanori
Created January 30, 2013 12:42
Show Gist options
  • Save fmasanori/4673029 to your computer and use it in GitHub Desktop.
Save fmasanori/4673029 to your computer and use it in GitHub Desktop.
Banco de Dados com sqlite3
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