【问题标题】:Problem with python prepared stmt parameter passingpython准备的stmt参数传递问题
【发布时间】:2019-04-19 13:12:45
【问题描述】:

文件 C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\mysql\connector\cursor.py,第 1149 行,在执行 elif len(self._prepared[parameters]) != len(params): TypeError: object of type int has no len()

【问题讨论】:

    标签: python parameters prepared-statement


    【解决方案1】:

    问题是python在传递单个参数时出错,我们需要输入逗号(,) 在第一个参数的末尾。像下面这样

    input=(customerId,)
    cursor.execute(sql, input)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多