#/usr/bin/env python
#coding:UTF-8
import time
import os,sys
import urllib2
url = 'http://downloaduat.laocaibao.com/front/front.war'
tm = time.strftime('%Y%m%d',time.localtime(time.time()))
warname = 'front.war'
downdir = '/home/deployer/update/'
def downloadbag():
print '''
开始下载新的文件包front.war
下载地址:http://downloaduat.laocaibao.com/front/front.war
'''
if (not os.path.exists(downdir+tm)):
os.mkdir(downdir+tm)
os.chdir(downdir+tm)
f = urllib2.urlopen(url)
data = f.read()
with open("front.war", "wb") as code:
code.write(data)
downloadbag()
转载于:https://www.cnblogs.com/franjia/p/6924295.html