python 查询数据库返回的数据类型

self.conn=MySQLdb.connect(host='localhost',port=3306, user='keystone', passwd='OptValley@4312', db=self.db_name)
self.cur = self.conn.cursor()
self.cur.execute(sqlstr)

rows=self.cur.fetchall()

rows的数据类型是个二维元组 ((1,1,1),)
如果为空是这样的((None,),)

注意元组只读不可修改

赠送:
随机读写:写速度快,读速度慢
顺序读写:链表结构,读速度块,写速度慢


猜你喜欢

转载自www.cnblogs.com/lfxiao/p/10521917.html