发布时间:2019-07-08 18:00:57编辑:auto阅读(1995)
1.基本用法
import pymysql
#建立连接
conn=pymysql.connect(
host='localhost',
port=3306,
user='root',
password='123456',
db='mydb'
)
#创建游标
cursor=conn.cursor()
#执行sql
effect_row=cursor.execute("select * from student")
#查询第一行
#row_1=cursor.fetchone()
#print(row_1)
#查询全部
row_all=cursor.fetchall()
print(row_all)
conn.commit()
cursor.close()
conn.close()
上一篇: Python基本数据类型__列表
下一篇: jenkins集成python
50973
50356
40971
37840
32303
29194
28080
22910
22873
21205
1074°
1751°
1433°
1368°
1638°
1454°
2113°
3660°
3591°
2529°