1import tarfile
2
3#simple function to extract the train data
4#tar_file : the path to the .tar file
5#path : the path where it will be extracted
6def extract(tar_file, path):
7 opened_tar = tarfile.open(tar_file)
8
9 if tarfile.is_tarfile(tar_file):
10 opened_tar.extractall(path)
11 else:
12 print("The tar file you entered is not a tar file")
13extract('/kaggle/input/gnr-638/train.tar.xz', '/kaggle/working/gnr-638')
14extract('/kaggle/input/gnr-638/test_set.tar.xz', '/kaggle/working/gnr-638')