2014-10-28 61 views
0
>>> e=searchengine.searcher('searchindex.db') 

>>> e.getmatchrows('functional programming') select w0.urlid,w0.location,w1.location from wordlocation w0,wordlocation w1 where w0.urlid=w1.urlid and w0.wordid=10 and w1.wordid=17 
SyntaxError: invalid syntax 

# it highlights the word select in the program 

如何更正select语句的语法错误?我使用Python与sqlite3。搜索引擎的查询码

回答

1

你不能只将SQL插入python文件。这个错误信息是python告诉你“我不知道选择是什么”。

为了更有帮助,你需要分享你从哪里得到“searchengine”,但不管它是什么,你的代码是无效的python,所以它没有办法工作。

+0

很可能只是'e.getmatchrows('函数式编程')'可能是您实际需要的。 – tripleee 2014-10-28 04:18:12