[英]How to untar a directory of tar files having tar.gz files internally in it?
[英]How to read and untar tar.gz files in IPython
我試過了
%%sh
tar xvf filename.tar.gz
但這沒用。 如何在IPython中讀取tar.gz文件。
我不明白為什么要用Python(特別是IPython)來做,但是沒關系...
為了使用Python將命令放入系統,我將使用子進程:
from subprocess import call
# The first param must be the command, and then the options,
# Something like
call(["tar", "-xzf", "filename.tar.gz"])
這不僅必須在Ipython上有效,而且在每個Python程序中都必須有效。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.