# -*- coding: utf-8 -*-
#---------------------------------------
# 程序:糗百爬虫
# 版本:0.2
# 作者:why
# 日期:2013-05-15
# 语言:Python 2.7
# 操作:输入quit退出阅读糗事百科
# 功能:按下回车依次浏览今日的糗百热点
# 更新:解决了命令提示行下乱码的问题
#---------------------------------------
import urllib2
import urllib
import re
import thread
import time
#----------- 处理页面上的各种标签 -----------
class HTML_Tool:
# 用非 贪婪模式 匹配 \t 或者 \n 或者 空格 或者 超链接 或者 图片
BgnCharToNoneRex = re.compile("(\t|\n| |<a.*?>|<img.*?>)")
# 用非 贪婪模式 匹配 任意<>标签
EndCharToNoneRex = re.compile("<.*?>")
# 用非 贪婪模式 匹配 任意<p>标签
BgnPartRex = re.compile("<p.*?>")
CharToNewLineRex = re.compile("(
|</p>|<tr>|<div>|</div>)")
CharToNextTabRex = re.compile("<td>")
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余4页未读,立即下载