尝试向表中添加值时出现以下错误:
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
Run Code Online (Sandbox Code Playgroud)
使用某些文本时会发生这种情况,如果我写的是常规内容,就没有问题,但是例如:
#. 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_'''
Run Code Online (Sandbox Code Playgroud)
失败了。这是我正在使用的代码:
def insert(table_name, proc, content):
conn = sqlite3.connect(sqlite_file)
conn.text_factory = str
c = conn.cursor()
c.execute("INSERT INTO {tn} (Process, …Run Code Online (Sandbox Code Playgroud)