成人在线亚洲_国产日韩视频一区二区三区_久久久国产精品_99国内精品久久久久久久

您的位置:首頁技術(shù)文章
文章詳情頁

python - 標(biāo)簽樹的下行遍歷如何跳過第一個(gè)標(biāo)簽

瀏覽:113日期:2022-08-08 11:07:17

問題描述

爬取網(wǎng)頁用下行遍歷的找出了我要的標(biāo)簽,但第一個(gè)的內(nèi)容我是不要的用.children好像無法跳出第一個(gè)標(biāo)簽

for tr in soup.find(id='endText').children: if tr.string is not None:a = tr.string

網(wǎng)頁的內(nèi)容:

python - 標(biāo)簽樹的下行遍歷如何跳過第一個(gè)標(biāo)簽原鏈接:http://digi.163.com/14/1115/0...

問題解答

回答1:

p_list = list(soup.find(id='endText').find_all(’p’))for p in p_list[1:]: text = p.get_text() img = p.find('img') if img:print img.get(’src’) if text:print text

標(biāo)簽: Python 編程
相關(guān)文章: