【问题标题】:"sqlite3.operationalerror unrecognized token" error“sqlite3.operationalerror 无法识别的令牌”错误
【发布时间】:2013-08-20 12:10:26
【问题描述】:

我有一个项目,我在其中实施了一个搜索引擎。我们的指南建议我们实现 O' Reilly 的 Collective Intelligence 2007 书中给出的代码。这是网页被索引的代码的一部分。我们正在使用 Sqlite3 数据库。我在代码的最后一部分出现错误,即使经过大量研究,我也没有成功。

    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: unrecognized token: "[some symbol i don't know]"

【问题讨论】:

标签: python sqlite operationalerror


【解决方案1】:

从 SQL 命令中删除反斜杠。

在 Python 中,\v 指定一个控制字符(垂直制表符)。

【讨论】:

  • 可能只是 values() 前少了一个空格?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-11-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-04-12
相关资源
最近更新 更多