• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell
您的位置:首页 > 脚本语言 >python > python使用7z解压apk包的方法

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

作者: 字体:[增加 减小] 来源:互联网

通过本文主要向大家介绍了python 7z,7z解压软件64位apk,7z压缩方法,7z解压软件,7z等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com

本文实例讲述了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/UTF8
run_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)

</div>

希望本文所述对大家的Python程序设计有所帮助。

</div>

您可能想查找下面的文章:

  • python使用7z解压apk包的方法
  • python使用7z解压软件备份文件脚本分享
  • python使用7z解压软件备份文件脚本分享

相关文章

  • python实现查找两个字符串中相同字符并输出的方法
  • Ubuntu 16.04 LTS中源码安装Python 3.6.0的方法教程
  • Python中set与frozenset方法和区别详解
  • Python实现查找系统盘中需要找的字符
  • Python的面向对象编程方式学习笔记
  • Python中内置数据类型list,tuple,dict,set的区别和用法
  • Python中下划线的使用方法
  • 跟老齐学Python之啰嗦的除法
  • Python的MongoDB模块PyMongo操作方法集锦
  • python检测远程端口是否打开的方法

文章分类

  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell

最近更新的内容

    • Ubuntu 14.04+Django 1.7.1+Nginx+uwsgi部署教程
    • 使用Python中的线程进行网络编程的入门教程
    • python脚本实现数据导出excel格式的简单方法(推荐)
    • Python实现TCP协议下的端口映射功能的脚本程序示例
    • python中set常用操作汇总
    • python使用clear方法清除字典内全部数据实例
    • python递归删除指定目录及其所有内容的方法
    • wxpython中利用线程防止假死的实现方法
    • Python 命令行非阻塞输入的小例子
    • Python 条件判断的缩写方法

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有