Extract the targz file using python

I was thinking that I wanted to extract the targz file on Windows, but I can do it in the following way, so I will record it.

extract_from_targz.py


import tarfile
import sys

args = sys.argv

with tarfile.open(args[1], "r:gz") as file:
    file.extractall(path=args[2])
    file.close()
>python extract_from_targz.py <targz filename> <Directory name after extraction>

Recommended Posts

Extract the targz file using python
Extract the xz file with python
Download the file in Python
Save the binary file in Python
Try using the Python Cmd module
[Python] File operation using if statement
Get the file path using Pathlib
Extract information using File :: Stat in Ruby
Try using the Wunderlist API in Python
Try using the Kraken API in Python
Behind the flyer: Using Docker with Python
Download the file from S3 using boto.
Check the existence of the file with python
Tweet using the Twitter API in Python
Let's read the RINEX file with Python ①
Working with OpenStack using the Python SDK
Read the file line by line in Python
Read the file line by line in Python
Reboot the router using Python, Selenium, PhantomJS
[Python] Get the character code of the file
[Python] Read the specified line in the file
python setup.py test the code using multiprocess
[Python3] Understand the basics of file operations
Script python file
Extract lines that match the conditions from a text file with python
Start using Python
Python file processing
Scraping using Python
Create a GIF file using Pillow in Python
Aggregate test results using the QualityForward Python library
vprof --I tried using the profiler for Python
[Python] Split a large Flask file using Blueprint
Extract only the file name excluding the directory in the directory
[Python] Let's execute the module regularly using schedule
[Automation] Extract the table in PDF with Python
Python: Try using the UI on Pythonista 3 on iPad
Try using the Python web framework Tornado Part 1
I tried reading a CSV file using Python
I tried using the Datetime module by Python
Pre-process the index in Python using Solr's ScriptUpdateProcessor
Operate the schedule app using python from iphone
Sound the buzzer using python on Raspberry Pi 3!
Try using the collections module (ChainMap) of python3
Run a Python file from html using Django
Extract zip with Python (Japanese file name support)
Find the geometric mean of n! Using Python
Convert the character code of the file with Python3
Try using the Python web framework Tornado Part 2
Create a MIDI file in Python using pretty_midi
Try using the DropBox Core API in Python
Run the Blue Prism process using Python (SOAP)
Get the update date of the Python memo file.
Find the maximum Python
Download the file while viewing the progress in Python 3.x
File operations in Python
Extract the table of image files with OneDrive & Python
[Python] File / directory operations
Operate Redmine using Python Redmine
Template of python script to read the contents of the file
Get the file name in a folder using glob
Upload JPG file using Google Drive API in Python