我无法弄清楚这里的问题是什么。我不断收到的错误代码是“字符串格式化期间参数数量错误”,但我个人没有发现任何问题。谁能指出我正确的方向?谢谢。
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()