OperationalError:无法识别的令牌sqlite3,python

时间:2016-08-12 21:47:06

标签: python sql sqlite

我一直收到一条错误,指出OperationalError:无法识别的令牌:我正在尝试使用sql将数据插入到数据库中,但是当程序启动时,我不知道我将需要的字段数量,因为这会根据具体情况而变化。因此,我一直在尝试使用for循环来创建一个要插入sql语句的字符串,这样我就可以将数据插入到数据库中。

    for y in Data_rearrange:
        g = y.replace(" ", "_")
        g = "'[" + g + "]'"
        DataString = DataString + g
        print(g)
        if y != Data_rearrange[-1]:
            DataString = DataString + ", "
    print(DataString)
    cur.execute("INSERT INTO Jackson VALUES (" + DataString + ")")

有谁知道sql语句的哪一部分会引发错误? 非常感谢

修改

'[Pro_Series_Dinky_DK2,_ Ebony_Fingerboard,_Satin_Orange_Blaze]','[2914105580]','[Pro_Series]','[$ 1156.45]','[Satin_Orange_Blaze]','[Dinky]','[Alder]',' [Gloss_Poly]','[1-Piece_Bolt-On_Maple_Speed_Neck_with_Graphite_Reinforcement_and_Scarf_Joint]','[25.5“_(648_mm)]','[12”_to_16“_Compound_Radius_(304.8_mm_to_406.4_mm)]','[24]','[ Jumbo]','[Floyd_Rose_R3_Locking]','[1.6875“_(42.86_mm)]','[Jackson_Pointed_6-In-Line]','[4-Bolt]','[Satin]','[Ebony] ','[Abalone_Dot]','[Direct_Mount_Seymour_Duncan_Zebra_JB_TB4_Humbucking]','[Direct_Mount_Seymour_Duncan_'59_Zebra_Humbucking]','[Master_Volume,_Master_Tone]','[5-Position_Blade:_Position_Position._1._Full_Bridge_Pickup,_Position_2._Bridge_Inner_Coil,_Position_3._Both_Inner_Coils, _Position_4 ._-_ Neck_Inner_Coil,_Position_5 ._ -_ Full_Neck_Pickup]','[HH]','[Floyd_Rose_FRT-O2000_Double-Locking_Tremolo_(Recessed)]','[Jackson_Sealed_Die-Cast]','[Right-Hand]',' [无]','[Black_Dome_Style]','[NPS,_。009-.042_Gauges]'

0 个答案:

没有答案