# 导入模块
import pymysql
# 连接数据库
mysql_conn = pymysql.connect(host="127.0.0.1",
                             port=3306,
                             user="root",
                             password="",
                             charset="utf8",
                             db="t1")
# 获取游标
c = mysql_conn.cursor(cursor=pymysql.cursors.DictCursor)
# SQL语句
sql = "select * from users WHERE name='jwb' and age=73 "
# 执行SQL
res = c.execute(sql)
# 打印结果
print(c.fetchall())
# 关闭游标
c.close()
# 关闭数据库
mysql_conn.close()