问题描述: 在导入bs4模块时有报错提示 “ Traceback (most recent call last): File "E:/project/code/py-pengfu/py-pf.py", line 6, in <module> from requests.exceptions import RequestExceptionModuleNotFoundError: No module named 'requests' ” 但是明明已经安装了bs4模块 解决方法:…
1.导入模块 from bs4 import BeautifulSoup 2.创建对象 Beautiful Soup支持Python标准库中的HTML解析器,还支持一些第三方的解析器,如果我们不安装它,则 Python 会使用 Python默认的解析器,lxml 解析器更加强大,速度更快,推荐安装. html = """ <html> <head><title>A Tale of Two Cities</title></h…