More & Less
created by yeshan333
博文
关于我
友链
开往
十年之约虫洞
境内访问
定向爬虫:仅对输入URL进行爬取,不扩展爬取中国大学排名2018
12345678910111213141516
import requestsfrom bs4 import BeautifulSoup #引入BeautifulSoup类url = "https://python123.io/ws/demo.html"r = requests.get(url)print(r.status_code)print("\n")#demo = r.text #html格式信息#soup = BeautifulSoup(demo,"html.parser")#使用html.parser对demo进行html解析soup = BeautifulSoup(open(r"C:\Users\Administrator\Desktop\beautifulsoup\demo.html"))print(soup.prettify())
BeautifulSoup官方文档
http://www.python-requests.org/en/master/ requests