2013-08-20 49 views
0

검색 엔진을 구현 한 프로젝트가 있습니다. 우리 가이드는 O'Reilly의 Collective Intelligence 2007 책자에있는 코드를 구현할 것을 제안했습니다. 이것은 웹 페이지의 색인이 생성되는 코드의 일부입니다. 우리는 Sqlite3 데이터베이스를 사용하고 있습니다. 코드의 마지막 부분에서 오류가 발생하고 많은 연구를 한 후에도 성공하지 못했습니다."sqlite3.operationalerror unrecognized token"오류가 발생했습니다.

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 datestamp] (http://stackoverflow.com/questions/11160637/sqlite3-operationaler-unrecognized-token-01t00-python-datestamp) –

+0

시도해 보았습니다. 하지만 작동하지 않습니다 ... –

답변

1

SQL 명령에서 백 슬래시를 제거하십시오.

파이썬에서 \v은 제어 문자 (수직 탭)를 지정합니다.

+0

그냥 공백 값() 전에 누락 될 수 있습니다? –