小編給大家分享一下怎么用python解壓分析jar包,希望大家閱讀完這篇文章之后都有所收獲,下面讓我們一起去探討吧!
創(chuàng)新互聯(lián)專注于陽西企業(yè)網(wǎng)站建設(shè),成都響應(yīng)式網(wǎng)站建設(shè),商城開發(fā)。陽西網(wǎng)站建設(shè)公司,為陽西等地區(qū)提供建站服務(wù)。全流程按需網(wǎng)站建設(shè),專業(yè)設(shè)計,全程項目跟蹤,創(chuàng)新互聯(lián)專業(yè)和態(tài)度為您提供的服務(wù)Python主要用來做什么Python主要應(yīng)用于:1、Web開發(fā);2、數(shù)據(jù)科學(xué)研究;3、網(wǎng)絡(luò)爬蟲;4、嵌入式應(yīng)用開發(fā);5、游戲開發(fā);6、桌面應(yīng)用開發(fā)。
代碼如下:
# -*- coding: utf-8 -*- import os import shutil import zipfile count = 1 def getSumDir(): sumfilelist = os.listdir(os.getcwd()) for dir in sumfilelist: if ".idea" not in dir: classify(dir) def getlibDir(): sumfilelist = os.listdir(os.getcwd()) for dir in sumfilelist: if "libs" in dir: jieyajar(dir) def jieyajar(dir): files = os.listdir(dir) for jars in files: if "jar" in jars: zfile = zipfile.ZipFile('libs/' + jars, 'r') if not os.path.exists(os.getcwd() + '/jarlog/' + jars): os.makedirs(os.getcwd() + '/jarlog/' + jars) zfile.extractall(os.getcwd() + '/jarlog/' + jars) if not os.path.exists(os.getcwd() + '/jars/'): os.makedirs(os.getcwd() + '/jars/') zfile.extractall(os.getcwd() + '/jars/') zfile.close for file in os.listdir(os.getcwd()): if "jars" in file: classify(file) # def classify(path): # if os.path.isfile(path): # if ".class" not in path: # if "assets" in os.path.dirname(path): # if not os.path.exists(os.path.dirname(os.getcwd()) + '/assets/' + os.path.dirname(path)): # os.makedirs(os.path.dirname(os.getcwd()) + '/assets/' + os.path.dirname(path)) # shutil.copy(path, os.path.dirname(os.getcwd()) + '/assets/' + os.path.dirname(path)) # else: # if not os.path.exists(os.path.dirname(os.getcwd())+'/root/'+os.path.dirname(path)): # os.makedirs(os.path.dirname(os.getcwd())+'/root/'+os.path.dirname(path)) # shutil.copy(path,os.path.dirname(os.getcwd())+'/root/'+os.path.dirname(path)) # else : # list = os.listdir(path) # for dir in list: # classify(path+"/"+dir) def classify(path): global count if os.path.isfile(path): if ".class" not in path: if not os.path.exists(os.getcwd() + '/root/' + os.path.dirname(path)): os.makedirs(os.getcwd() + '/root/' + os.path.dirname(path)) shutil.copy(path, os.getcwd() + '/root/' + os.path.dirname(path)) else: if 'assets' in path and count == 1: count = count + 1 shutil.copytree(os.getcwd()+'/'+path, os.getcwd() + '/assets') elif 'META-INF' not in path: list = os.listdir(path) for dir in list: classify(path + "/" + dir) # getSumDir() getlibDir()
看完了這篇文章,相信你對“怎么用python解壓分析jar包”有了一定的了解,如果想了解更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝各位的閱讀!