lannn_l

2020年12月13日

爬中国大学排名网站内容

摘要: import csv import os import requests from bs4 import BeautifulSoup allUniv = [] def getHTMLText(url): try: r = requests.get(url, timeout=30) r.raise_f 阅读全文

posted @ 2020-12-13 23:44 lannn_l 阅读(81) 评论(0) 推荐(0) 编辑

这是一个简单的html页面,请保持为字符串,完成后面的计算要求。

摘要: from bs4 import BeautifulSoup import re soup=BeautifulSoup('''<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(runoob.com)</title> </h 阅读全文

posted @ 2020-12-13 22:49 lannn_l 阅读(459) 评论(0) 推荐(0) 编辑

请用requests库的get()函数访问如下一个网站20次,打印返回状态,text()内容,计算text()属性和content属性所返回网页内容的长度。

摘要: import requests url="https://www.baidu.com/" def gethtml(url): try: r=requests.get(url) r.raise_for_status() r.encoding="utf-8" print("text内容:",r.text 阅读全文

posted @ 2020-12-13 22:11 lannn_l 阅读(137) 评论(0) 推荐(0) 编辑

导航