sqlite3.ProgrammingError:提供的绑定数量不正确。(sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 74 supplied)
def query_by_msm_code(msm_code):
conn = sqlite3.connect(BASE_PATH + '/' + 'search_prod.db')
cur = conn.cursor()
sql = "select jlc_code from code_info where msm_code = ?"
try:
cur.execute(sql, list(msm_code])) # [msm_code]] 就不报错
思考:
ss = 'abc'
list(ss) 和 [ss] 的区别?
>>> ss = 'abc'
>>> a = list(ss)
>>> a
['a', 'b', 'c']
>>> c = [ss]
>>> c
['abc']
>>>
本文来自博客园,作者:chuangzhou,转载请注明原文链接:https://www.cnblogs.com/czzz/p/16916634.html