python 爬虫系列01-连接mysql
爬虫学习中.........................................
import pymysql conn = pymysql.connect(host='172.16.1.52',user='root',password='123456',database='mysql',port=3306) curor = conn.cursor() sql = """ select user,host from user """ curor.execute(sql) results = curor.fetchmany(2) for result in results: print(result) conn.close()
人生就像一滴水,非要落下才后悔!
--kingle