# -*- coding: utf-8 -*-
# python 2.6
# auther: moqi88 # gmail.com
# date: 2010-10-25
import re
import urllib
filepath = ur"D:/内部资料/大量数据/申请表/"
url = 'http://www.zju.edu.cn/files/'
filetype = "/file.doc"
for i in range(100, 999):
try:
response = urllib.urlopen(url + str(i) + filetype)
headers = response.info()
data = response.read()
if (len(data) > 500):
f = file(filepath + str(i) + 'file.doc', 'wb')
f.write(data)
f.close()
print "No. " + str(i) + " : " + str(len(data))
else:
print "No. " + str(i) + " : " + "NOT FOUND"
except IOError, e:
print e