python3pymysql查询结果包含字段名
python2使⽤MySQLdb模块进⾏连接mysql数据库进⾏操作;python3则使⽤pymysql模块进⾏连接mysql数据库进⾏操作;两者在语法上有稍微的差别,其中就包括查询结果包含字段名,具体例⼦如下:gorilla怎么读
吸血鬼日记第一季全集
vovpython2:
import MySQLdb
conn = t(host='127.0.0.1',ur='root',passwd='root',db='adu')
cur = conn.cursor(cursorclass=MySQLdb.cursors.DictCursor)
sql = 'lect * from test1'
reCount = ute(sql)
drop table
nRet = cur.fetchall()
cur.clo()
conn.clo()
print(nRet)
print(reCount)
sombra
pytnon3:
import pymysql
conn = t(host='127.0.0.1',ur='root',passwd='root',db='adu')
柔软的意思cur = conn.cursor(cursor=pymysql.cursors.DictCursor)
sql = 'lect * from test1'
reCount = ute(sql)
up是什么意思
幼儿启蒙英语下载nRet = cur.fetchall()
cur.clo()
conn.clo()
mopprint(nRet)
whoisit
print(reCount)