0
我用来获取标记该Beautifulsoup extracking属性类型错误:“NoneType”对象不是可迭代
for a in soup.find_all('img', {'data-event': 'Clicked image'},
src=True,alt=True):
itemobj = a['src'] + ' --- ' + a['alt']
属性现在我在其他网站上工作,当我尝试这样扔类型错误:“NoneType”对象是不是可迭代
song_link = line.find('td').find('a')['href'] (This works well)
sss = line.find('span')['title'] (This in not working. But when I delete ['title'] part it works and shows inside of the <span> tag
我的数据:
<span class="rating" title="4.5">
<span class="icon-rating-sm icon-rating-sm__active"></span>
<span class="icon-rating-sm icon-rating-sm__active"></span>
<span class="icon-rating-sm icon-rating-sm__active"></span>
<span class="icon-rating-sm icon-rating-sm__active"></span>
<span class="icon-rating-sm icon-rating-sm__half"></span>
</span>
我一直在寻找解决THI但到目前为止,他们都没有为我工作。
你能说清楚你的问题吗?你在'line'变量中存储了什么?这是你发布的数据吗? –