Answers for "tar dataset"

0

tar dataset

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")
Posted by: Guest on June-15-2020

Python Answers by Framework

Browse Popular Code Answers by Language