当我使用 python 从 SQL 数据库中获取结果时,我会在返回值的开头和结尾获得额外的章程。例如,下面的代码返回 ((56L,),) 而不是 56,有谁知道如何获取值...以及 (( ,),) 的实际含义...?
hp= 56
id= 3
database = MySQLdb.connect (host="localhost", user = "root", passwd = "", db = "db")
cursor = database.cursor()
cursor.execute("UPDATE period_option SET points =%s WHERE period_option_id =%s", (hp, id))
cursor.execute("SELECT points FROM period_option WHERE period_option_id =%s", (po_id_home))
results = cursor.fetchall()
print results