MySQLdb使用程序
#!/bin/env python import MySQLdb conn = MySQLdb.connect(host = "", user="", passwd="", port=8307, db="") cursor = conn.cursor() try: cursor.execute(sql) data = cursor.fetchall() conn.commit() except MySQLdb.Error, e: print e cursor.close() for row in data: print row
时间: 2024-10-11 08:37:37