I wrote this code. When I run it I don't get errors but I can't get the values inserted in the table, I end up with a database with table1 that's empty. Any help?
TabelName = 'table1' values = [1, 1, 1.0, 1.0, 0] columnsNmes =['Day', 'Month', 'Hour', 'HOY', 'Sun Falling on Tower Facade'] fieldTypes = [REAL,REAL,REAL,REAL,REAL] filepath = 'C:\xampp\htdocs\FT-test9.db' conn = sqlite3.connect(filePath) c = conn.cursor() try: c.execute('CREATE TABLE IF NOT EXISTS {tn} ({nf} {ft})'\ .format(tn=tableName, nf=columnsNames[0], ft=fieldTypes[0])) for i, j in zip(columnsNames[1:], fieldTypes[1:]): c.execute("ALTER TABLE {tn} ADD COLUMN '{cn}' {ct}"\ .format(tn=tableName, cn=i, ct=j)) except: pass newColumnsNmes = [] for d in data: m =float(d) newColumnsNames.append(m) for m,n in zip(newColumnsNames, data): c.execute("INSERT INTO {tn} {cn} VALUES {vn}"\ .format(tn=tableName, cn=m, vn= n)) conn.commit() conn.close()