Python Mysql Tutorials
Python Mysql Tutorials
import MySQLdb
#!/usr/bin/python
import MySQLdb
db = MySQLdb.connect("localhost",root",root","TESTDB" )
cursor = db.cursor()
try:
cursor.execute(sql)
results = cursor.fetchall()
fname = row[0]
lname = row[1]
age = row[2]
sex = row[3]
income = row[4]
print "fname=%s,lname=%s,age=%d,sex=%s,income=%d" % \
except:
db.close()