
Python学习
文章平均质量分 54
Catcheryp
Nothing replaces hard work!
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Python爬虫学习(单线程爬虫(一))
import requestsimport reimport sysreload(sys)sys.setdefaultencoding("gb18030")type = sys.getfilesystemencoding()headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, l原创 2016-02-06 15:29:11 · 737 阅读 · 0 评论 -
Python爬虫学习(单线程爬虫(二))
这里要注意到网页异步加载的问题,在代码中切换page,可得到不同公司的信息import requestsimport reurl = 'https://www.crowdfunder.com/browse/deals&template=false'# html = requests.get(url).text# print htmldata = { 'entities_o原创 2016-02-06 16:23:54 · 563 阅读 · 0 评论 -
Python爬取一个网页的图片
import urllib2import rereq=urllib2.urlopen('http://www.imooc.com/course/list')buf=req.read()listurl =re.findall(r'http:.+\.jpg',buf)print listurli=1for url in listurl: f=open(str(i)+'.jpg',原创 2016-02-06 09:30:06 · 778 阅读 · 0 评论 -
Python爬虫(单线程爬虫(三))
这里极客学院的网站可能升级了所以爬不到应该会得到的结果了,就当实例看一下就行#-*_coding:utf8-*-import requestsimport reimport sysreload(sys)sys.setdefaultencoding("utf-8")class spider(object): def __init__(self): print原创 2016-02-06 17:08:42 · 673 阅读 · 0 评论 -
Python爬虫学习(简单的模拟登陆(一))
可以成功的爬取我室友的微博首页#-*-coding:utf8-*-import requestsfrom lxml import etreecook = {"Cookie": "此处请填写你获取到的Cookie"}url = 'http://weibo.cn/u/xxxxxxxx' #此处请修改为微博网址# html = requests.get(url).content# p原创 2016-02-07 11:15:40 · 1017 阅读 · 0 评论 -
Python爬虫学习(简单的模拟登陆(二))
用cookie模拟新浪微博登录,可以对某人新浪微博是否更新进行实时的邮件监控#-*-coding:utf8-*-import smtplibfrom email.mime.text import MIMETextimport requestsfrom lxml import etreeimport osimport timeimport sysreload(sys)sys.原创 2016-02-08 07:59:04 · 1080 阅读 · 0 评论