基于py3和pymysql的数据库查询,查询某几列的数据

#python3
#xiaodeng
#基于py3和pymysql的数据库查询,查询某几列的数据


import pymysql
conn=pymysql.connect(....)
cur=conn.cursor()

cur.execute("select name,age from nlist")
data=cur.fethall()
for name,age in data: print name,age conn.close() cur.close()
原文地址:https://www.cnblogs.com/dengyg200891/p/5348470.html