Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Windows中解析包含BeautifulSoup4、Chardet和Python 3.3的页面时出错_Python_Html_Windows_Beautifulsoup_Chardet - Fatal编程技术网

在Windows中解析包含BeautifulSoup4、Chardet和Python 3.3的页面时出错

在Windows中解析包含BeautifulSoup4、Chardet和Python 3.3的页面时出错,python,html,windows,beautifulsoup,chardet,Python,Html,Windows,Beautifulsoup,Chardet,当我尝试调用BeautifulSoup(第页)时,出现以下错误 我期待您的回答我刚刚遇到这种情况。 不要导入chardet,我也会卸载chardet。 然后构建就会通过 下面的代码是beautifulsoup中的dammit.pylib的一部分。 可能您导入的chardet不适合Python3.3,因此会发生错误 try: # First try the fast C implementation. # PyPI package: cchardet import cch

当我尝试调用BeautifulSoup(第页)时,出现以下错误


我期待您的回答

我刚刚遇到这种情况。
不要导入chardet,我也会卸载chardet。
然后构建就会通过
下面的代码是beautifulsoup中的
dammit.py
lib的一部分。
可能您导入的chardet不适合Python3.3,因此会发生错误

try:
    # First try the fast C implementation.
    #  PyPI package: cchardet
    import cchardet
    def chardet_dammit(s):
        return cchardet.detect(s)['encoding']
except ImportError:
    try:
        # Fall back to the pure Python implementation
        #  Debian package: python-chardet
        #  PyPI package: chardet
        import chardet
        def chardet_dammit(s):
            return chardet.detect(s)['encoding']
        #import chardet.constants
        #chardet.constants._debug = 1
    except ImportError:
        # No chardet available.
        def chardet_dammit(s):
            return None
import sys
from urllib.request import urlopen
from bs4 import BeautifulSoup
import re
import chardet

url = "http://www.edgar-online.com/brand/yahoo/search/?cik=1400810"
page = urlopen(url).read()
#print(page)
soup = BeautifulSoup(page)
try:
    # First try the fast C implementation.
    #  PyPI package: cchardet
    import cchardet
    def chardet_dammit(s):
        return cchardet.detect(s)['encoding']
except ImportError:
    try:
        # Fall back to the pure Python implementation
        #  Debian package: python-chardet
        #  PyPI package: chardet
        import chardet
        def chardet_dammit(s):
            return chardet.detect(s)['encoding']
        #import chardet.constants
        #chardet.constants._debug = 1
    except ImportError:
        # No chardet available.
        def chardet_dammit(s):
            return None