摘要: 用requests库的get()函数访问必应网页20次,打印返回状态,text()内容,计算text()属性和content()属性所返回网页内容的长度。 代码为: import requests for i in range(20): r=requests.get("https://cn.bing 阅读全文
posted @ 2020-05-13 20:24 Judy-dd 阅读(310) 评论(0) 推荐(0) 编辑
摘要: 爬取中国大学网站http://www.zuihaodaxue.com/zuihaodaxuepaiming2019.html 代码: import requests from bs4 import BeautifulSoup allUniv = [] def getHTMLText(url): tr 阅读全文
posted @ 2020-05-13 20:23 Judy-dd 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 代码: from bs4 import BeautifulSoup r='''<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(runoob.com)</title> </head> <body> <hl>我的第一个标题 阅读全文
posted @ 2020-05-13 20:22 Judy-dd 阅读(283) 评论(0) 推荐(0) 编辑