-1

I uploaded a zip file to my EC2 Linux notebook, and extracted it, the extracted files were in 7z format rather than csv. So is there a way to extract from the zip file in a csv format or convert/read 7z into csv?

I have already tried the existing solutions given for similar questions, but none of them seem to work.

  • Unsure whether the `zip` module can process 7z files. My advice is to use 7zip to extract the csv file, and only then process it with Python. – Serge Ballesta Mar 21 '19 at 07:25

2 Answers2

2

I found the solution -

This will install the 7zip tool :

 sudo apt-get install p7zip-full

This will extract the .7z file in a .csv file :

7za x <filename.tar.7z>
0

You can extract zip files in 7z format using the py7zlib module from pylzma. Alternatively, you can extract it using something like 7-zip.

Nathaniel
  • 3,230
  • 11
  • 18