文章详情页
python - 标签树的下行遍历如何跳过第一个标签
浏览:172日期:2022-08-08 11:07:17
问题描述
爬取网页用下行遍历的找出了我要的标签,但第一个的内容我是不要的用.children好像无法跳出第一个标签
for tr in soup.find(id='endText').children: if tr.string is not None:a = tr.string
网页的内容:
原链接: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
相关文章:
1. javascript - vue组件通过eventBus通信时,报错a.$on is not a function2. python3.x - python3.5.2安装时make报错求助3. html - vue项目中用到了elementUI问题4. javascript - 在使用 vue.js element ui的时候 怎么样保留table翻页后check的值?5. mysql_replication - mysql读写分离时如果单台写库也无法满足性能怎么解决6. angular.js - 如何控制ngrepeat输出的个数7. ionic 项目 ionic build android -release 打包时报错8. mac里的docker如何命令行开启呢?9. python - 如何用pandas处理分钟数据变成小时线?10. 为什么学习PHP
排行榜

网公网安备