语法错误PYODBC
大家好
我已经看这个代码太久了,现在不能发现错误。我正在尝试将从xml文件中提取的数据导入数据库。当我运行程序时,虽然我得到了一个语法错误,try:被突出显示。我找不到错误。谢谢大家。你知道吗
for x in range(len(sentences)):
slice2 = sentences[max(0,x-1):min(len(sentences),x+2)]
sentencelist.append([dewiki.from_string(s) for s in slice2])
if "theory" in sentences[x].lower():
slice1 = sentences[max(0,x-1):min(len(sentences),x+2)]
surroundingsentences.append(['[[[&t]]]' + dewiki.from_string(s) for s in slice1])
slicelinks.append([(links.findall(s)) for s in slice1])
query1 = unicode("""INSERT INTO SENTENCE (TheoryDocID, SliceWithMarkUp, SliceText) VALUES ({},'{}','{}')""".format(id, slice2.replace("'","''"), slice1.replace("'","''")
try:
cur.execute(query1)
cur.commit()
except:
print query1
conn.close()
你好像少了两个括号
应该是:
相关问题 更多 >
编程相关推荐