0

Is there any way to get the issue of a field by its Column name. I need something like this:

import MySQLdb

db = MySQLdb.connect(host="***",    # your host, usually localhost
                     user="***",                     # your username
                     passwd="***",                      # your password
                     db="***")                     # name of the data base
sql="SELECT * FROM t_table"
cur = db.cursor()
cur.execute(sql)
cur.fetchall()[0]['firstName']

table lookslike that (sry i dont know how to create table here):

id |firstname|lastname

1  |Paul     |Peter

Have anyone an idea?

nicoschuck
  • 201
  • 3
  • 13

0 Answers0