import pymysql
conn = pymysql.connect(host='118.24.3.40',user='jxz',password='123456',port=3306,db='jxz',charset='utf8',autocommit=True)
cur = conn.cursor(pymysql.cursors.DictCursor) #建立游标
# sql='select * from app_myuser;'
# sql='insert into app_myuser (username,passwd,is_admin) values ("nhy123","456789",1);'
# cur.execute(sql)#只是执行sql,并不会返回数据
# conn.commit()
# print(cur.fetchall()) #获取到所有返回的数据
print(cur.fetchone()) #只取一条数据
cur.close()
conn.close()
cur.description获取到表结构