Extracting a 7-Zip file “silently” - command line option

后端 未结 14 2317
南笙
南笙 2021-02-06 23:19

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).

Is there a way to avoid t

14条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-07 00:08

    On Unix-like operating systems (Linux, BSD, etc.) the shell command 7z ... >/dev/null will discard all text written by 7z to standard output. That should cover all the status/informational messages written by 7z.

    It seems that 7z writes error messages to standard error so if you do >/dev/null, error messages will still be shown.

提交回复
热议问题