Python3.6。我试图为sqlite3创建一个REGEXP函数。我有个错误:OperationalError: wrong number of arguments to function REGEXP()
这是我的代码:
import sqlite3
import re
def fonctionRegex(mot):
patternRecherche = re.compile(r"\b"+mot.lower()+"\\b")
return patternRecherche.search(item) is not None
dbName = 'bdd.db'
connexion = sqlite3.connect(dbName)
leCursor = connexion.cursor()
connexion.create_function("REGEXP", 1, fonctionRegex)
mot = 'trump'
data = leCursor.execute('SELECT * FROM tweet WHERE texte REGEXP ?',mot).fetchall()
谢谢
你做错了什么。这是更正确的例子
将打印
^{pr2}$documentation上写着:
函数必须有两个参数。在
相关问题 更多 >
编程相关推荐