1
我需要找到具有任何鼠標事件註冊在線 例如所有標籤的所有標籤,它應該找到標籤,如:使用beautifulsoup找到與某種形式的屬性
<div onmousedown="somefunc()"> Some text here </div>
我可以檢查使用功能如bs4文檔中給出的:
def reg_event(tag):
return tag.has_key('onmousedown')
tags_with_mouse_event = soup.find_all(reg_event)
但檢查多個需要很多.has_key結合或..是否有一些更簡單的方法?