📜  mysql 未读结果找到 - 任何代码示例

📅  最后修改于: 2022-03-11 14:58:15.532000             🧑  作者: Mango

代码示例2
/* If you looping through cursor & running another query,python no like*/
/* Store results into list first then loop again running query*/
/* So something like this*/

results = list()
for (id,fname,lname) in cursor:
    results.append({"id":id,"fname":fname,"lname":lname})
    
for r in results:
    id=r['id']
    query = ("update user set fname='whatever' where id = "+str(id))
    cursor.execute(query)
    cnx.commit()