小编Isa*_*ank的帖子

AttributeError: 模块“copy”没有属性“deepcopy”

我实际上是 Python 和 BS4 的新手。我决定创建一个脚本来抓取一个网站,准确地说是 oscarmini.com,直到今天我想修改它时代码运行良好,我不断收到错误,在我对异常和错误的了解很少的情况下,似乎来自'bs4'模块的导入的代码没有任何问题..

from bs4 import BeautifulSoup as BS
import requests
url = 'https://oscarmini.com/2018/05/techfest-2018.html'
page = requests.get(url)
soup = BS(page.text, 'lxml')
mydivs = soup.find("div", {"class": "entry-content"})
soup.find('div', id="dpsp-content-top").decompose()
print(mydivs.get_text())
input()
Run Code Online (Sandbox Code Playgroud)

以下是我收到的错误消息。

Traceback (most recent call last):
    File "C:/Users/USERNaME/Desktop/My Programs/Random/Oscarmini- 
Scrapper.py", line 1, in <module>
    from bs4 import BeautifulSoup as BS
File "C:\Users\USERNaME\AppData\Local\Programs\Python\Python36-32\lib\site-packages\bs4\__init__.py", line 35, in <module>
    import xml.etree.cElementTree as default_etree
File ":\Users\USERNaME\AppData\Local\Programs\Python\Python36-32\lib\xml\etree\cElementTree.py", line 3, in <module>
    from xml.etree.ElementTree import *
File "C:\Users\USERNaME\AppData\Local\Programs\Python\Python36-32\lib\xml\etree\ElementTree.py", line 1654, in <module>
    from …
Run Code Online (Sandbox Code Playgroud)

python xml beautifulsoup elementtree

3
推荐指数
1
解决办法
4379
查看次数

标签 统计

beautifulsoup ×1

elementtree ×1

python ×1

xml ×1