爬虫

(.*?)你想要获取的东西

.*?任何字段

#coding=utf-8  (有中文编辑都要加编码格式)

import re
import urllib
def getHtml(url):
content=urllib.urlopen(url).read
return content

def getNum(html):
reg=r'<span.*?style="color:red">(.*?)</span>'
Numlist=re.findall(reg,html)
return Numlist

html=getHtml("http://www.pc3777.com/pc28/")
Number=getNum(html)
print Number

posted @ 2016-11-18 11:16  jetlin  阅读(175)  评论(0编辑  收藏  举报