【问题标题】:Beautifoulsoup .getText() erorBeautifulsoup .getText() 错误
【发布时间】:2021-01-16 19:13:13
【问题描述】:
for teknik in teknik_ayrıntılar:
detayler = teknik.find_all("tr")
    for i in detayler:
        teknik = i.find("th",attrs={"class":"prodDetSectionEntry"}).get_text()
        değer = i.find("td",attrs={"class":"a-size-base"}).get_text()
        print(teknik +"="+ değer)

当我写“teknik.get_text()”和“değer.get_text()”python 发送这个错误 "AttributeError: 'NoneType' 对象没有属性 'get_text'"

你知道吗?

我正在使用 Python 3.7.3。

【问题讨论】:

  • 请考虑python中的indention's。在您的 for 循环中它是不正确的。

标签: python python-3.x beautifulsoup


【解决方案1】:

正如documentation 所说,如果发生该错误,则没有与您的查询匹配的标签。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-06-17
    • 2017-02-26
    • 1970-01-01
    • 2012-05-18
    • 2016-07-11
    • 1970-01-01
    相关资源
    最近更新 更多