1 Star 0 Fork 0

wangkechun / spidersforhnustportal

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
htmlre.py 696 Bytes
一键复制 编辑 原始数据 按行查看 历史
wangkechun 提交于 2013-08-28 13:45 . first commit
# -*- coding: utf-8 -*-
import sys
import re
def printf(s):
print s.decode('utf8').encode('gbk')
s=open(r'data/1255010203.html').read()
s=s.decode('gbk').encode('utf8')
s=s.replace('\n','')
r=r'''学号.+?\>.+?\>(.+?)\<.+?
姓名.+?\>.+?\>(.+?)\<.+?
身份证号.+?\>.+?\>&nbsp;(.+?)\<.+?
户口详细地址.+?\>.+?\>&nbsp;(.+?)\<.+?
家庭电话.+?\>.+?\>&nbsp;(.+?)\<.+?
宿舍地址.+?\>.+?\>&nbsp;(.+?)\<.+?
宿舍电话.+?\>.+?\>&nbsp;(.+?)\<.+?
手机号.+?\>.+?\>(.+?)\<.+?
'''
l=re.compile(r,re.X).findall(s)
printf(str(l))
printf(l[0][0])
printf(l[0][1])
printf(l[0][2])
printf(l[0][3])
printf(l[0][4])
printf(l[0][5])
printf(l[0][6])
printf(l[0][7])
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wkc/spidersforhnustportal.git
git@gitee.com:wkc/spidersforhnustportal.git
wkc
spidersforhnustportal
spidersforhnustportal
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891