- 论坛徽章:
- 0
|
自动更新免费列表用的 从学校网页抓数据输出到屏幕
现在有个问题 就是这个脚本在freebsd5.4下可以正常运行 输出数据到屏幕
可是在6.1下 运行后没有反应 不知道为什么
我不会写脚本 这个是同学帮我写的 谁知道这是怎么回事儿吗?
6。1&5。4的两个python都是pkg装的
#!/usr/bin/python
import urllib
import re
#get html source
sock = urllib.urlopen("http://hitsun.hit.edu.cn/zxiplist.htm")
htmlSource = sock.read()
sock.close()
#delete unexpected '</st1:chsdate>'
htmlSource = htmlSource.replace('</st1:chsdate>', '')
#find all ips
ippattern = re.compile(r'\d+\.\d+\.\d+\.\d+')
list = re.findall(ippattern, htmlSource)
#output to std
i = 0
for str in list:
print str,
i = i+1
if i%3 == 0:
print '\n',
else:
print '\t', |
|