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']
>>>
posted @ 2022-11-22 21:56  chuangzhou  阅读(885)  评论(0编辑  收藏  举报