2014-10-28 118 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