首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > perl python >

抓取一个简单网页上的所有文字信息 有点急该怎么处理

2012-03-19 
抓取一个简单网页上的所有文字信息有点急http://www.myjob.edu.cn/enterprise/page/view_student.jsp?id2

抓取一个简单网页上的所有文字信息 有点急
http://www.myjob.edu.cn/enterprise/page/view_student.jsp?id=2000001

我想把上面的个人文字信息抓取到 保存到记事本里

谢谢!!


[解决办法]
curl http://www.myjob.edu.cn/enterprise/page/view_student.jsp?id=2000001 > your_file
[解决办法]
不考虑js:

Python code
import urllibimport redef toText(html):    html = re.sub(r'<[^<>]*>', '', html)    html = html.replace('&nbsp;', ' ')    return html.strip()def extractHtml(html):    p = re.findall(r'"navism">(.*?)</td>\s*(:?<td[^<>]*>(.*?)</td>)?', html, re.S)    p = map(lambda x: (toText(x[0]), toText(x[1])), p)    p = filter(lambda x: x[0], p)    for w in p:        print w[0], w[1]html = urllib.urlopen('http://www.myjob.edu.cn/enterprise/page/view_student.jsp?id=2000001').read()extractHtml(html) 

热点排行