import MySQLdb
import MySQLdb.cursors
cxn=MySQLdb.Connect(host='localhost',user='root',passwd='1234',db='db_name',port=3306,\
cursorclass=MySQLdb.cursors.DictCursor,charset="utf8")
cur=cxn.cursor()
cur.execute("select * from tablename")
for i in cur.fetchall():
print type(i)
break;