发布时间:2019-08-29 07:35:36编辑:auto阅读(1874)
#!/usr/bin/python
# _*_ coding: utf-8 _*_
'''
Created on 2018年8月22日
'''
import urllib
import urllib2
import re
req = urllib2.Request('http://repo.zabbix.com/zabbix/3.5/rhel/7/x86_64/')
# req = urllib2.Request('http://www.cvpapers.com/cvpr2014.html')
f = urllib2.urlopen(req)
localDir = 'E:\download\\'
urlList = []
for eachLine in f:
line = eachLine.strip()
if re.match('.*rpm.*', line):
# print(line)
wordList = line.split('\"')
for word in wordList:
if re.match('.*\.rpm$', word):
# print(word)
urlList.append(word)
for everyFile in urlList:
# print (everyFile)
everyURL = "http://repo.zabbix.com/zabbix/3.5/rhel/7/x86_64/"+everyFile
# print(everyURL)
localFile = localDir + everyFile
try:
urllib.urlretrieve(everyURL, localFile) #按照url进行下载,并以其文件名存储到本地目录
except Exception,e:
continue
上一篇: python3.5操作office Ex
下一篇: 零基础学习Python文本处理
47880
46445
37333
34773
29346
26008
24960
19978
19580
18074
5821°
6449°
5962°
5988°
7093°
5937°
5979°
6472°
6435°
7818°