gpt4 book ai didi

Python-Sqlite-OperationalError : near "s": syntax error

转载 作者:太空狗 更新时间:2023-10-30 02:26:14 24 4
gpt4 key购买 nike

<分区>

尝试向表中添加值时出现以下错误:

line 33, in insert
c.execute("INSERT INTO {tn} (Process, Info) VALUES('{proc}',
'{inf}')".format(tn=table_name, proc=proc, inf=content))
OperationalError: near "s": syntax error

当使用某些文本时会发生这种情况,如果我写一些常规的东西就没有问题,但是例如这样的东西:

#. My item number one
#. My item number two with some more content
and it's continuing on the second line?
#. My third item::
Oh wait, we can put code!
#. My four item::
No way.
.. _bottom:
Go to top_'''

失败了..这是我正在使用的代码:

def insert(table_name, proc, content):

conn = sqlite3.connect(sqlite_file)
conn.text_factory = str
c = conn.cursor()

c.execute("INSERT INTO {tn} (Process, Info) VALUES('{proc}',
'{inf}')".format(tn=table_name, proc=proc, inf=content))

conn.commit()
conn.close()

感谢你们的帮助:)

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com