Python 爬虫实战:豆瓣电影页面 HTML 代码获取
以下 Python 代码,使用 requests 和 BeautifulSoup 库实现爬取网页 HTML 代码:
import requests
from bs4 import BeautifulSoup
url = 'https://movie.douban.com/subject/25868125/'
response = requests.get(url)
html = response.content
soup = BeautifulSoup(html, 'html.parser')
print(soup.prettify())
运行代码后,会输出该网页的 HTML 代码。
原文地址: https://www.cveoy.top/t/topic/oBaR 著作权归作者所有。请勿转载和采集!