【发布时间】:2019-12-09 18:49:46
【问题描述】:
我目前正在学习网页抓取,我正在尝试保存页面的 html 版本: "https://www.wuxiaworld.co/Master-Hunter-K/1061716.html" 使用美丽的汤和请求模块。
每次我在 html 文件的统计信息中得到这些  字符时,用 …†而不是 "
这是我的代码:
from bs4 import BeautifulSoup
import requests
link = "https://www.wuxiaworld.co/Master-Hunter-K/1061716.html"
html = requests.get(link,timeout = 2)
soup = BeautifulSoup(html.text,'html.parser')
with open("test.html","a",encoding ="utf-8-sig") as file:
file.write(str(soup))
任何帮助将不胜感激。谢谢
【问题讨论】:
标签: html python-3.x web-scraping