1 回答
TA贡献1829条经验 获得超7个赞
goquery是解析 html 内容的好库。
html := `
<table><tbody id="the-list">
<tr>
<td valign="top" align="right">1.</td>
<td valign="top">BEKASI</td>
<td valign="top">Tambun</td>
<td valign="top">Selatan</td>
<td valign="top">01.4.13.16.06.000013</td>
<td valign="top">Jalan</td>
<td valign="top">PERUM BEKASI GRIYA ASRI</td>
<td valign="top">1.500 m<sup>2</sup></td>
<td valign="top" align="center">Kantor</td>
<td valign="top">400 m<sup>2</sup></td>
<td valign="top" align="center">1998</td>
<td valign="top" align="center">> 200</td>
<!--
<td valign="top" align="center">-6.2245</td>
<td valign="top" align="center">107.0827</td>
-->
<td valign="top" align="right">3</td>
<td valign="top" align="right">7</td>
<td valign="top" align="right">2</td>
<td valign="top" align="right">150</td>
<td valign="top">08888123</td>
<td valign="top">-</td>
</tr>
</tbody></table>
`
doc, _ := goquery.NewDocumentFromReader(strings.NewReader(html))
sel := doc.Find("#the-list td")
for i := range sel.Nodes{
n := sel.Eq(i)
fmt.Println(n.Text())
}
- 1 回答
- 0 关注
- 163 浏览
添加回答
举报