用户:
小鹿deer查看:3 回复:5 评论:3 创建时间:2020-10-04T14:17:19
【作品展示】

【作品介绍】
可用积木,本人没用风变编程作业
【作品源代码】
import requests
pachong_1 = requests.get('https://shequ.codemao.cn/')
pachong_2 = pachong_1.text
print(pachong_2)
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn
啸猫我优化了一下:
import requests,easygui
A = easygui.enterbox('输入需要爬取源代码的网站','爬取信息')
if ((A in "https://") or (A in "http://")):
pachong_1 = requests.get(A)
elif((A in "edge://") or (A in "chorme://")):
if easygui.ynbox('这个网站可能跟浏览器有关。如果爬取,可能会损坏浏览器。确定继续?','爬取信息',('确定爬取','结束爬取')):
pachong_1 = requests.get(A)
else:
if(easygui.ynbox('网站是否采用了https协议?','爬取信息',('已采用','未采用'))):
pachong_1 = requests.get("https://" + A)
A = "https://" + A
else:
pachong_1 = requests.get("http://" + A)
A = "http://" + A
if A != None:
pachong_2 = pachong_1.text
easygui.msgbox(pachong_2,'爬取信息-' + A,'结束')
点赞1
评论
UP主終黙import requests,easygui
A = easygui.enterbox('输入需要爬取源代码的网站','爬取信息')
if ((A in "https://") or (A in "http://")):
pachong_1 = requests.get(A)
elif((A in "edge://") or (A in "chorme://")):
if easygui.ynbox('这个网站可能跟浏览器有关。如果爬取,可能会损坏浏览器。确定继续?','爬取信息',('确定爬取','结束爬取')):
pachong_1 = requests.get(A)
else:
if(easygui.ynbox('网站是否采用了https协议?','爬取信息',('已采用','未采用'))):
pachong_1 = requests.get("https://" + A)
A = "https://" + A
else:
pachong_1 = requests.get("http://" + A)
A = "http://" + A
if A != None:
pachong_2 = pachong_1.text
easygui.msgbox(pachong_2,'爬取信息-' + A,'结束')点赞0
评论