问题
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