首页 > 代码库 > 使用Python操作MySQL

使用Python操作MySQL

比较简单,直接上代码了。

import MySQLdbdef showResult(res):        for i in res:                print iconn=MySQLdb.connect(host="localhost",user="root",passwd="123456",db="cloud",charset="utf8")cursor = conn.cursor()cursor.execute(select * from filelist)res = cursor.fetchall()showResult(res)

 

使用Python操作MySQL