line = line.strip() TypeError: 'NoneType' object is not callable

前端 未结 1 1438
没有蜡笔的小新
没有蜡笔的小新 2021-01-27 05:33

I am trying to find all num\'s in a list from an html using beautifulsoup:

import urllib
from BeautifulSoup i         


        
相关标签:
1条回答
  • 2021-01-27 06:20

    That's because you are trying to run strip on the tag class within beautiful soup.

    Change line 14 to:

     line = line.string.strip()
    

    However be aware that this can still be None when the tag you are searching for has multiple sub elements. Seee link to string method on doco for beautiful soup

    0 讨论(0)
提交回复
热议问题