首页 > 编程语言 > 详细

python更新游戏程序

时间:2018-06-27 23:49:29      阅读:325      评论:0      收藏:0      [点我收藏+]
#!/usr/bin/env python #coding:utf-8 import os import shutil import zipfile dm_path = ‘/data/bz-tw-and‘ script_path = os.getcwd() new_dm_dir = script_path+‘/bz_new/scripts‘ after_zip = ‘.zip‘ for (root,dirs,filename) in os.walk(script_path): for file in filename: if file[-4:] == after_zip: zip_package = os.path.join(root,file) z = zipfile.ZipFile(zip_package,‘r‘) z.extractall(script_path+‘bz_new‘) z.close for qu_name in os.listdir(dm_path): backup_dm = dm_path+‘/‘+qu_name+‘/‘+‘_scripts‘ now_dm = dm_path+‘/‘+qu_name+‘/‘+‘scripts‘ if os.path.exists(backup_dm): shutil.rmtree(backup_dm) os.rename(now_dm,backup_dm) else: os.rename(now_dm,backup_dm) shutil.copytree(new_dm_dir,now_dm) os.remove(now_dm+‘/Config.lua‘) shutil.copyfile(dm_path+‘/‘+qu_name+‘/Config.lua‘,now_dm+‘/Config.lua‘)

python更新游戏程序

原文:http://blog.51cto.com/yht1990/2133459

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!