📜  tar 数据集 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:42.359000             🧑  作者: Mango

代码示例1
import tarfile

#simple function to extract the train data
#tar_file : the path to the .tar file
#path : the path where it will be extracted
def extract(tar_file, path):
    opened_tar = tarfile.open(tar_file)
     
    if tarfile.is_tarfile(tar_file):
        opened_tar.extractall(path)
    else:
        print("The tar file you entered is not a tar file")