国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

python使用7z解壓apk包的方法

2020-02-23 00:48:21
字體:
來源:轉載
供稿:網友

本文實例講述了python使用7z解壓apk包的方法。分享給大家供大家參考。具體如下:

這段代碼通過shell調用7z對apk包進行解壓縮

def run_shell(command, mayFreeze=False): def check_retcode(retcode, cmd): if 0 != retcode: print >> sys.stderr, 'err executing ' + cmd + ':', retcode sys.exit(retcode) def read_close(f): f.seek(0) d = f.read() f.close() return d #print >> sys.stderr, '-- Executing', command if mayFreeze: tempout, temperr = tempfile.TemporaryFile(), tempfile.TemporaryFile() #open(os.devnull, 'w') p = subprocess.Popen(command, stdout=tempout, stderr=temperr) p.wait() output, errout = read_close(tempout), read_close(temperr) else: p=subprocess.Popen(command,stdout=subprocess.PIPE,stderr=subprocess.PIPE) output = p.stdout.read() p.wait() errout = p.stderr.read() p.stdout.close() p.stderr.close() #check_retcode(p.returncode, command) return (output.strip(), errout.strip())#z7 is the full path to 7z.exe#at times you have to encode the command into GBK/UTF8run_shell(u'{0} -y -o"{1}" {2} x "{3}"'.format(z7, tempdir, icon, apk))shutil.copy(u'{0}/{1}'.format(tempdir,os.path.basename(icon)),dst_path)

希望本文所述對大家的Python程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 阿克苏市| 临沭县| 微博| 安康市| 河东区| 安阳县| 乡城县| 谷城县| 改则县| 杭锦旗| 杭锦后旗| 横峰县| 南充市| 闽清县| 武陟县| 敦煌市| 桐柏县| 泸定县| 肥西县| 新津县| 竹溪县| 临泽县| 东乌珠穆沁旗| 恩平市| 清徐县| 景德镇市| 涟源市| 平和县| 昌黎县| 威海市| 陆丰市| 历史| 遵化市| 永仁县| 大庆市| 茶陵县| 昭平县| 夏邑县| 瓦房店市| 濮阳市| 石门县|