UnicodeDecodeError:'utf8'编解码器无法解码位置5的字节0xbb:无效的起始字节

时间:2019-09-04 12:54:15

标签: python python-2.7 web-scraping utf-8

我正在使用Python 2.7,但遇到无法修复的错误。我正在尝试从页面下载HTML,并且下一个按钮如下所示:下一个»

Traceback (most recent call last):
  File "C:\Users\Said&Nour\Desktop\Documents\PythonFiles\LebanonParsing\Al Rifai\alrifai.py", line 109, in <module>
    if PageP.find('a',attrs={'title':'Next »'}) is None:
  File "C:\Python27\lib\site-packages\bs4\element.py", line 1300, in find
    l = self.find_all(name, attrs, recursive, text, 1, **kwargs)
  File "C:\Python27\lib\site-packages\bs4\element.py", line 1321, in find_all
    return self._find_all(name, attrs, text, limit, generator, **kwargs)
  File "C:\Python27\lib\site-packages\bs4\element.py", line 602, in _find_all
    strainer = SoupStrainer(name, attrs, text, **kwargs)
  File "C:\Python27\lib\site-packages\bs4\element.py", line 1420, in __init__
    normalized_attrs[key] = self._normalize_search_value(value)
  File "C:\Python27\lib\site-packages\bs4\element.py", line 1434, in _normalize_search_value
    return value.decode("utf8")
  File "C:\Python27\lib\encodings\utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xbb in position 5: invalid start byte

0 个答案:

没有答案