“静默"提取 7-Zip 文件- 命令行选项 [英] Extracting a 7-Zip file "silently" - command line option

查看:53
本文介绍了“静默"提取 7-Zip 文件- 命令行选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 Python 脚本中提取 7-Zip 存档.它工作正常,只是它会吐出提取细节(这对我来说是巨大的).

I want to extract a 7-Zip archive in a Python script. It works fine except that it spits out the extraction details (which is huge in my case).

有没有办法在提取时避免这种冗长的信息?我没有找到 7z.exe 的任何静默"命令行选项.

Is there a way to avoid this verbose information while extracting? I did not find any "silent" command line option to 7z.exe.

我的命令是

7z.exe -o some_dir x some_archive.7z

推荐答案

一种可能性是使用 popen,因此它的输出将返回到父级进行处理/显示(如果需要)或完全忽略(创建您的 popen具有 stdout=PIPEstderr=PIPE 的对象,以便能够从孩子那里检索输出).

One possibility would be to spawn the child process with popen, so its output will come back to the parent to be processed/displayed (if desired) or else completely ignored (create your popen object with stdout=PIPE and stderr=PIPE to be able to retrieve the output from the child).

这篇关于“静默"提取 7-Zip 文件- 命令行选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆