How do i select specific elements from div?

試著忘記壹切 提交于 2019-12-12 06:47:30

问题


I want to get the date from this div:

<div class="pandatacontcol" style=" width:160px;">
    <h6>Date Qualified</h6>
    <p id="QualDate34868684">2013-03-08 12:04:01</p>
</div>

so output would be: 2013-03-08

I tried to do like that:

elements = doc.select("p[id^=\"QualDate\"]");

but it doesn't work.


回答1:


Try without quote marks

doc.select("p[id^=QualDate]");

Value of attribute is set inside quote marks <tag attribute="value">, but those quote marks are not part of value.



来源:https://stackoverflow.com/questions/15465463/how-do-i-select-specific-elements-from-div

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!