Skip to content

Instantly share code, notes, and snippets.

Created August 26, 2016 02:02
Show Gist options
  • Save anonymous/870ca4f8bc8fdf6c9975038aa69802f4 to your computer and use it in GitHub Desktop.
Save anonymous/870ca4f8bc8fdf6c9975038aa69802f4 to your computer and use it in GitHub Desktop.
import sqlite3
from Alimentos import *
connection = sqlite3.connect('bancoalimentos.db')
c = connection.cursor()
def create_table():
c.execute('CREATE TABLE IF NOT EXISTS alimentos (id integer, alimentos text, \
valor real)')
create_table()
def dados():
'''
c.execute("INSERT INTO alimentos VALUES(1,'banana',10.5)")
c.execute("INSERT INTO alimentos VALUES(2,'batata',10.3)")
c.execute("INSERT INTO alimentos VALUES(3,'barata',10.4)")
'''
for i in alimentos:
c.execute("INSERT INTO alimentos(alimentos, valor) VALUES(?,?)"(alimentos,alimentos[i]))
connection.commit()
dados()
@lsabiao
Copy link

lsabiao commented Aug 26, 2016

Linha 20, faltando ,
Acho que você está colcando os valores errados na query da linha 20.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment