首页 > IT职业 > IT生活 > python爬虫思路
python2
爬虫:从网页上采取数据
爬虫模块:urllib,urllib2,re,bs4,requests,scrapy,xlml
1.urllib
2.request
3.bs4
4.正则re
5种数据类型
(1)数字Number
(2)字符串String
(3)列表List[] 中文在可迭代对象就是unicode对象
(4)元组Tuple()
(5)字典Set{}
爬虫思路:
1.静态 urlopen打开网页------获取源码read
2.requests(模块) get/post请求----获取源码 text()方法 content()方法(建议)
3.bs4 能够解析HTML和XML
#-- coding:utf-8 --
from bs4 import BeautifulSoup
#1
#html="
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/3566/viewspace-2802607/ ,如需转载,请注明出处,否则将追究法律责任。