zoukankan      html  css  js  c++  java
  • 获取百度首页中的子链接地址

    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))
    

      

  • 相关阅读:
    适者生存还是强者生存
    写给十岁的清为
    毕业后的十年
    Python3 字符编码
    线段树模板
    F
    E
    D
    C
    B
  • 原文地址:https://www.cnblogs.com/yanwuming/p/11626790.html
Copyright © 2011-2022 走看看