0

我正在制作一个简单的 Web 表单,但我尝试运行此代码它给了我一个错误我是 python 新手我不知道这个错误意味着什么并且无法在线找到解决方案。这是一个代码:

from flaskext.mysql import MySQL
from datetime import date
from dateutil import parser
mysql = MySQL()
app = Flask(__name__)
app.config['MYSQL_DATABASE_USER'] = 'mraghib'
app.config['MYSQL_DATABASE_PASSWORD'] = 'raghib10'
app.config['MYSQL_DATABASE_DB'] = 'fyp'
app.config['MYSQL_DATABASE_HOST'] = 'localhost'
mysql.init_app(app)

if __name__ == ("__main__"):
    cursor = mysql.connect().cursor()
    print(cursor.execute("select * from companylist"))
    addcompanyList= ("INSERT INTO CompanyList (Ticker, CompanyName, SECP_Sector_Code, SectorName,OutstandingShares,DemoSheetName,Years) ""VALUES (%s, %s ,%int, %s,%int, %s, %s)")
    datacompanyList = ("sdasd","adsda",142,"daasda",32,"sdadas",date(1977, 6, 14))

    cursor.execute (addcompanyList,datacompanyList) 

在此处输入图像描述

4

1 回答 1

0

尝试这个:

ddcompanyList= ("""INSERT INTO CompanyList (Ticker, CompanyName,SECP_Sector_Code, SectorName,OutstandingShares,DemoSheetName,Years) VALUES(%s, %s ,%s, %s, %s, %s, %s)""")
于 2017-12-09T15:56:31.300 回答