0

May I know what I need to modify or add to my import script for me to compress a csv file to .tar?

My script

export_csv(
     my_csv=my_csv,
    sheet_id=gsheet_name(worksheet_name)
)

shutil.move(my_csv, '/home/admin/processedCSV')

# If its possible my plan is after moving the CSV file to another folder that time the tar extraction will execute. 
print ('DONE')

Let me know if you need more details. TYIA

rodskies
  • 119
  • 1
  • 11
  • 1
    For what it's worth, `tar` is just an archive format, not a compressed format. Modern tools like `zip` provide both archiving (combining many files into one container) and compression, but `tar` only does the former. However, Python's `tarfile` module can transparently create a `.tar.gz` (or `.bz2` etc) which is also compressed. – tripleee May 20 '22 at 04:13

1 Answers1

0

Take a look at the tarfile module in the standard library: https://docs.python.org/3/library/tarfile.html.

ndc85430
  • 1,395
  • 3
  • 11
  • 17