在处理大量数据时,可能需要从网站上爬取数据。可以使用Python的requests库和BeautifulSoup库来实现网络爬虫。
import requests
from bs4 import BeautifulSoup
url = "https://www.example.com/"
response = requests.get(url)
soup = BeautifulSoup(response.content, "html.parser")
links = soup.find_all("a")
for link in links:
href = link.get("href")
print(href)