【发布时间】:2013-09-18 23:57:36
【问题描述】:
我想在 html 代码中找到一个特定的标签,比如如果有 2 个标签,那么我怎样才能获得第二个标签的内容,而不是 soup.find(id='contact1') 在这里所做的第一个标签的内容示例html代码
<table align="center"><th id="contact">STUDENT ID</th><th id="contact">NAME</th><th id="contact"> Phone </th><th id="contact"> NO.</th>
<p align="center" style="display:compact; font-size:18px; font-family:Arial, Helvetica, sans-serif; color:#CC3300">
</p><tr>
<td id="contact1">
2011XXA4438F </td> <td id="contact1"> SAM SRINIVAS KRISHNAGOPAL</td> <td id="contact1"> 9894398690 </td> <td id="contact1"> </td>
</tr>
</table>
我想要做的是将“2011XXA4438F”提取为字符串我该怎么做?
【问题讨论】:
标签: python html django beautifulsoup