python 爬虫笔记(二)
来源:互联网 发布:希腊罗马神话 知乎 编辑:程序博客网 时间:2024/05/30 22:50
抓取一个页面 id为giftList 的 table,的所有子节点
! /usr/bin/env python
coding=utf-8
import urllib2from bs4 import BeautifulSouphtml=urllib2.urlopen("http://www.pythonscraping.com/pages/page3.html")bsObj=BeautifulSoup(html)for child in bsObj.find("table",{"id":"giftList"}).children: print(child)
#! /usr/bin/env python#coding=utf-8import urllib2from bs4 import BeautifulSouphtml=urllib2.urlopen("http://www.pythonscraping.com/pages/page3.html")bsObj=BeautifulSoup(html)for siblings in bsObj.find("table",{"id":"giftList"}).tr.next_siblings: print(siblings)
#! /usr/bin/env python#coding=utf-8import urllib2from bs4 import BeautifulSouphtml=urllib2.urlopen("http://www.pythonscraping.com/pages/page3.html")bsObj=BeautifulSoup(html)print(bsObj.find("img",{"src":"../img/gifts/img1.jpg"}).parent.previous_sibling.get_text())
0 0
- python 爬虫笔记(二)
- Python爬虫实践笔记(二)
- Python爬虫urllib2笔记(二)
- Python爬虫练习笔记二
- python 爬虫(二)
- python爬虫(二)
- python爬虫(二)
- Python 爬虫(二)
- Python学习笔记(二)网络刷博器爬虫
- 学习笔记—Python网络爬虫(二)
- Python爬虫(二)图片下载爬虫
- Python 爬虫学习笔记二: xpath 模块
- WSWP(用python写爬虫)笔记二:实现链接获取和数据存储爬虫
- Python爬虫整理(二)
- python简单爬虫(二)
- python网络爬虫(二)
- Python爬虫实战(二)
- python爬虫记录(二)
- [BZOJ1040][ZJOI2008]骑士(树形dp)
- Linux Mint配置
- cocos-js判断类型
- java IO流
- 取数游戏
- python 爬虫笔记(二)
- 各种语言下程序运行时间的计算(时间间隔)
- java 数组实现栈
- Win7我的电脑图标电击右键添加设备管理器
- ServletContext和ServletConfig
- python自动化测试
- Poj 3686 The Windy's【KM匹配】
- Struts+Hibernate+Spring学习心得(2)Hibernate
- Jenkins如何更改主目录