Я получаю сообщение об ошибке: TypeError: объект типа 'NoneType' не имеет len () - PullRequest
0 голосов
/ 27 апреля 2020
def cleanText(Ctext):
    Ctext = Ctext.lower() if Ctext and isinstance(Ctext,str) else None
from bs4 import BeautifulSoup
Ctext = BeautifulSoup(Ctext, features="lxml").get_text()

Я получаю следующую ошибку: -

TypeError: object of type 'NoneType' has no len()
TypeError                                 Traceback (most recent call last)
<ipython-input-23-a43a6e62c976> in <module>
    211 elif mda != 0 and qqd == 0 and rfs != 0:
    212     print(5)
--> 213     obj_clean_mda = cleanText(mda)
    214     obj_clean_rf = cleanText(rfs)
    215     obj_clean = obj_clean_mda.extend(obj_clean_rf)
<ipython-input-9-fa9dfc8a0e1b> in cleanText(Ctext)
      8 
      9     from bs4 import BeautifulSoup
---> 10     Ctext = BeautifulSoup(Ctext, features="lxml").get_text()
     11 
     12 
C:\ProgramData\Anaconda3\lib\site-packages\bs4\__init__.py in __init__(self, markup, features, builder, parse_only, from_encoding, exclude_encodings, **kwargs)
    243         if hasattr(markup, 'read'):        # It's a file-type object.
    244             markup = markup.read()
--> 245         elif len(markup) <= 256 and (
    246                 (isinstance(markup, bytes) and not b'<' in markup)
    247                 or (isinstance(markup, str) and not '<' in markup)

TypeError: object of type 'NoneType' has no len()
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...