标签:text response ref 链接地址 python rom highlight 百度首页 首页
import os
import requests
from bs4 import BeautifulSoup
import lxml
def Gethtml(url):
response=requests.get(url)
response.encoding="utf-8"
# print(response.text)
return response.content
def parseHtml(html):
msg=BeautifulSoup(html,features="lxml")
for item in msg.findAll("a"):
print(item.get("href"))
#print(msg)
url="http://wwww.baidu.com"
#Gethtml(url)
parseHtml(Gethtml(url))
标签:text response ref 链接地址 python rom highlight 百度首页 首页
原文地址:https://www.cnblogs.com/yanwuming/p/11626790.html