python第二天_网络爬虫
来源:互联网 发布:网络接入设备 编辑:程序博客网 时间:2024/06/01 08:20
学python的第二天,学习来自于 http://blog.csdn.net/lyjamare/article/details/17006027
# -*- coding: cp936 -*-
#http://movie.douban.com/tag/%E5%8A%A8%E4%BD%9C?start=0&type=T
import urllib2
import re
import sys
# 获取当前系统编码格式
type = sys.getfilesystemencoding()
j = 0
url = 'http://tieba.baidu.com/f?kw=%D1%F8%D5%FD%D6%D0%D1%A7'
content = urllib2.urlopen(url).read()
match = re.findall(r' <a .*?class="j_th_tit">(.*?)</a>', content)
for i in range(0,2000):
print match[i]
print len(match)
自己打了一篇,然后就萌生出想获取贴吧的帖子的想法。
但最终只获取到了置顶帖子的名字。
分析了一下原因 应该是出现在url上的获取 没有一个重新赋值的过程,今天继续加油。
Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>
★★▂▃▄↑ 养正中学吧 欢迎你 ↑▄▃▂ ★★
Traceback (most recent call last):
File "G:\pythonCode\crawler1.0.py", line 14, in <module>
print match[i]
IndexError: list index out of range
>>>
- python第二天_网络爬虫
- python第三天_网络爬虫
- python爬虫学习第二天
- python核心编程第二版中的网络爬爬虫修改
- 第二课 Python爬虫网络请求request模块详解
- 用python写网络爬虫读书笔记 第二章数据抓取
- python爬虫学习第二十六天
- Python爬虫_基础
- 【Python网络爬虫】python网络数据采集读书笔记(第二章)
- 黑马程序员_网络爬虫
- python 网络爬虫代码
- Python实现网络爬虫
- Python实现网络爬虫
- Python实现网络爬虫
- python实现网络爬虫
- python网络爬虫
- python实现网络爬虫
- Python 网络爬虫
- android OpenGl 游戏编写过程
- PowerDesigner逆向工程
- oracle中常用查询总结
- 如何看MS SQLSERVER数据库的执行计划
- js/jquery随机放置网页内容
- python第二天_网络爬虫
- Data Clustering:A Review
- jsp实现拒绝IP为。。的用户
- Android-小项目之迷你英文词典-使用existing sqlite database-github第三库android-sqlite-asset-helper
- git报错:Pull is not possible because you have unmerged files解决方法
- 学习小结
- HTTP协议详解
- js调用父窗口(父页面)的方法
- shell 更新所有git目录