我正在尝试获取标签数据
html示例:
<span class=\"value\">3.99<\/span> average rating,\n
这是我的代码:
d = BeautifulSoup(fstuff.text, 'html.parser')
d.select_one("span.average").text
但我有一个错误:
--------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-60-b6b8329a8fe3> in <module>()
----> 1 d.select_one("span.average").text
AttributeError: 'NoneType' object has no attribute 'text'
请帮帮我! 谢谢
如果您想获得值
3.99
,只需使用如果要获取
average rating,
,请使用next_sibling
代码:
相关问题 更多 >
编程相关推荐