[問題] 爬蟲,find()找重複的標籤
小弟爬蟲新手
正在用google的geocode做爬蟲練習
以下是部分原始碼
<GeocodeResponse>
<status>OK</status>
<result>
<type>establishment</type>
<type>point_of_interest</type>
<type>university</type>
已知用bsobj.find("result").find("type")是第一個type
請問要如何用find或是next_sibling去爬第二個和第三個type?
ps:試過用next_sibling()
dataType = bsobj.find("result").find("type")
dataType2 = dataType.next_sibling()
return dataType2
系統給我
TypeError: 'NavigableString' object is not callable
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 73.223.41.252
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1531863864.A.D8C.html
推
07/18 05:47,
7年前
, 1F
07/18 05:47, 1F
→
07/18 05:51,
7年前
, 2F
07/18 05:51, 2F
→
07/18 05:52,
7年前
, 3F
07/18 05:52, 3F
推
07/18 07:41,
7年前
, 4F
07/18 07:41, 4F
推
07/18 10:33,
7年前
, 5F
07/18 10:33, 5F
→
07/18 10:33,
7年前
, 6F
07/18 10:33, 6F
Python 近期熱門文章
PTT數位生活區 即時熱門文章