I'm looking for a way to make a query to MySQL from Python, for this I'm supporting the documentation official . The problem is that although I can connect and do the query without problems, I am unable to go through the results, look for the data that interests me by the name of the column in the table.
import MySQLdb db=MySQLdb.connect(host="localhost",user="user",passwd="contra",db="basedatos") c=db.cursor() c.execute("SELECT * FROM tabla") c.fetchall() for juego in c: print(juego) pass
That is, I want to modify
juego['Nombre'] , which would be the name of the column. This more than anything is because the structure of the table can change and force me to modify the code every time this happens. I tried with single quotes, double quotes and parentheses, and it has not served me any.