周志洋

个人站

持续学习 才能不被淘汰


Python实用技巧-网页抓取基础

BeautifulSoup 基础

from bs4 import BeautifulSoup
import requests

response = requests.get('https://example.com')
soup = BeautifulSoup(response.text, 'html.parser')
title = soup.find('title').text

选择器使用

links = soup.find_all('a', href=True)
for link in links:
   print(link['href'])


转载请注明:周志洋的博客 » Python实用技巧-网页抓取基础

打赏一个呗

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦