摘要: import requests from bs4 import BeautifulSoup ALL = [] def getHTMLtext(url): try: r = requests.get(url,timeout = 30) r.raise_for_status() r.encoding = 阅读全文
posted @ 2020-12-13 14:01 小松可可奈 阅读(192) 评论(0) 推荐(0)
摘要: 三、根据所给的html页面,保持为字符串,完成如下要求: (1)打印head标签内容和你学号的后两位 (2)获取body标签的内容 (3)获取id的first的标签对象 (4)获取并打印html页面中的中文字符 from bs4 import BeautifulSoup r = ''' <!DOCT 阅读全文
posted @ 2020-12-13 13:24 小松可可奈 阅读(437) 评论(0) 推荐(0)
摘要: 2)请用requests库的get()函数访问如下一个网站20次,打印返回状态,text()内容,计算text()属性和content属性所返回网页内容的长度。import requests for i in range(20): r=requests.get("https://cn.bing.co 阅读全文
posted @ 2020-12-13 13:07 小松可可奈 阅读(297) 评论(0) 推荐(0)