# -*- coding: utf-8 -*-
from urllib.request import Request,HTTPHandler,HTTPSHandler,urlopen,build_opener,install_opener
# from urllib.parse import urlencode
import string
def tieba(url,begin,end):
for i in range(begin,end+1):
sName = 'download_'+str(i)+'.html'
print( '正在下载第'+str(i)+'个网页,并将其存储为'+sName+'......')
f=open(sName,'wb+')
m=urlopen(url+str(i)).read()
f.write(m)
f.close
bdurl = 'http://bmeoptlab.tju.edu.cn/index.php?m=List&a=index&cid=2&p='
print(bdurl)
# begin = int(input('请输入开始的页数:'))
# end = int(input('请输入终止的页数:'))
tieba(bdurl,1,4)
07-26