我搞不懂这里有什么问题。我一直得到的错误代码是“错误的参数数量在字符串格式化”,但我个人没有看到任何问题。有人能给我指出正确的方向吗?谢谢。你知道吗
def film_function(number, film):
connection = connect(host='localhost', user='root', \
passwd='', db='survey')
cursor = connection.cursor()
sql = "SELECT * FROM persons, persons_films WHERE persons.person = persons_films.person AND number_of_films >= %s AND film = '%s' ORDER BY persons_films.person"
cursor.execute(sql, [number], [film])
rows = cursor.fetchall()
if not rows:
print ("No one in "+film+" found!")
else:
for row in rows:
print row[0],"-", row[1]
cursor.close()
connection.close()
这个。。。你知道吗
应该是这样的:
您要传递的是单个参数列表,而不是每个参数都有一个单独的列表。你知道吗
相关问题 更多 >
编程相关推荐