您的位置:首页 > 博客中心 > 数据库 >

使用Python操作MySQL

时间:2022-03-14 03:40

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

import MySQLdb

def showResult(res):
        for i in res:
                print i

conn=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)

 

热门排行

今日推荐

热门手游