2013-08-20 117 views
0

我有一個項目,我已經實現了搜索引擎。我們的指南建議我們實施O'Reilly集體智慧2007年書中給出的代碼。這是網頁編入索引的代碼的一部分。我們正在使用Sqlite3數據庫。我在代碼的最後部分遇到錯誤,甚至在經過很多研究之後,我沒有成功。「sqlite3.operationalerror無法識別的令牌」錯誤

def addtoindex(self,url,soup): 
if self.isindexed(url): return 
print 'Indexing '+url 
# Get the individual words 
text=self.gettextonly(soup) 
words=self.separatewords(text) 
# Get the URL id 
urlid=self.getentryid('urllist','url',url) 
# Link each word to this url 
for i in range(len(words)): 
    word=words[i] 
    if word in ignorewords: continue 
    wordid=self.getentryid('wordlist','word',word) 
    self.con.execute("insert into wordlocation(urlid,wordid,location)\values (%d,%d,%d)" % (urlid,wordid,i)) 

我收到以下錯誤在最後一行:

sqlite3.OperationalError:無法識別的標記: 「[一些符號,我不知道]」

請幫幫忙!

+0

可能重複的[sqlite3.OperationalError:無法識別的令牌:「01T00」Python日期戳](http://stackoverflow.com/questions/11160637/sqlite3-operationalerror-unrecognized-token-01t00-python-datestamp) – 2013-08-20 12:13:36

+0

我試過但它不工作... –

回答

1

從SQL命令中刪除反斜槓。

在Python中,\v指定了一個控制字符(垂直標籤)。

+0

可能只是一個空間之前缺少值()? – 2013-08-20 13:24:20

相關問題