超级简易版爬虫
from urllib.request import urlopen # 导入一个模块
 干掉数字签名
 import ssl
ssl._create_default_https_context = ssl._create_unverified_context


 def func():
 获取到网页中的内容, 当网速很慢的时候. 反复的去打开这个网站. 很慢
 content = urlopen("https://www.dytt8.net/").read()

 def inner():
 return content.decode("gbk") # 网页内容
 return inner

 print("开始网络请求")
 ret = func() # 网络请求已经完毕
 print("网络请求完毕")
 print("第一次", ret()[5])
 print("第二次", ret()[5]) 

posted on 2018-12-11 15:47  赵龙飞  阅读(101)  评论(0编辑  收藏  举报