Created
August 26, 2016 02:02
-
-
Save anonymous/870ca4f8bc8fdf6c9975038aa69802f4 to your computer and use it in GitHub Desktop.
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 | |
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Linha 20, faltando ,
Acho que você está colcando os valores errados na query da linha 20.