TypeError: not all arguments converted during string formatting,

最近在拼接sql的时候遇到了这个问题:

sql_module_code += """ AND per.project_id in '%s' """ % project_id

修改之后:

sql_module_code += """ AND per.project_id in ('%s','%s') """ % project_id

格式化的时候出现错误,project_id中有几个元素前面就要有几个占位符。

猜你喜欢

转载自blog.csdn.net/qq_37304462/article/details/112301759