有人可以告诉我为什么我一直收到错误:invalid syntax
。我无法想象,错误在第6行并且是'reorder_file':
import sqlite3
product_db = sqlite3.connect("G://Computing\\Reorder_file.db")
c = product_db.cursor()
c.execute("DROP TABLE if exists Reorder_file.db")
c.execute("CREATE TABLE reorder_file(GTIN8_Product_Code text, Product_Description text, Cost float, Stock integer, Reorder_Level integer, Target_Level integer)"
reorder_file = open("reorder_file.txt", "w")
reorder_file .write("Reorder File")
reorder_file .write("GTIN8, Product Description, Price, Stock Level, Reorder Level, Target Level")
答案 0 :(得分:0)
删除 reorder_file 和 .write 之间的空格。
我运行以下内容并没有收到任何错误:
reorder_file = open("reorder_file.txt", "w")
reorder_file.write("Reorder File")
reorder_file.write("GTIN8, Product Description, Price, Stock Level, Reorder Level, Target Level")
请告诉我这是否适合您。