Search code examples
pythoncsv7zip

How do I extract or read a csv file from 7z file using Python?


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.


Solution

  • 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>