仅作演示用

from bs4 import BeautifulSoup
import urllib.request

webfile = urllib.request.urlopen('http://www.baidu.com')
webcontext = webfile.read().decode("UTF-8")

soup = BeautifulSoup(webcontext,"html.parser")

urlInfo = soup.findAll('div',id = 'u')

print(urlInfo[0].next.text)
print(urlInfo[0].next.get('href'))

 

相关文章:

  • 2021-08-27
  • 2022-12-23
  • 2022-02-08
  • 2022-12-23
  • 2022-12-23
  • 2021-12-12
  • 2021-10-06
  • 2022-12-23
猜你喜欢
  • 2021-06-30
  • 2021-07-22
  • 2022-01-02
  • 2021-12-02
  • 2021-08-08
  • 2022-12-23
  • 2021-12-31
相关资源
相似解决方案