我正在努力学习美汤。我使用下面的网址来学习。https://programminghistorian.org/en/lessons/intro-to-beautiful-soup
当我尝试运行代码时,我得到下面的错误。
FileNotFoundError: [Errno 2] No such file or directory: 'what_is_beautiful_soup_in_python-Google_Search.html'Python模块和HTML文件都保存在同一个文件夹中。文件名= what_is_beautiful_soup_in_python-Google_Search谁能帮我解决这个问题?
from bs4 import BeautifulSoup
soup = BeautifulSoup(open("what_is_beautiful_soup_in_python-Google_Search.html"), features="lxml")
print(soup.prettify())发布于 2020-03-11 21:49:11
仔细检查html文件的名称和对html文件的引用。然后检查扩展名并确保它是一个html文档。考虑将html文件名改为更简单的名称,如'index.html‘(这有助于大拇指变胖)。
https://stackoverflow.com/questions/60636442
复制相似问题