I have this current code to unzip the contents of archive
to extract_dir
. However, I cannot figure out how to get the extracted file path & name of the extracted file.
if archive.endswith((".zip")):
zip_ref = zipfile.ZipFile(archive, 'r')
zip_ref.extract(extract_dir)
zip_ref.close()
For example, if the archive is called test.zip
and ZipFile extracts the contents test.exe
I want get C:/windows/users/admin/downloads/test.exe
in to a variable?
EDIT: Sorry I wasn't clear, in the source code for zipfile targetpath is returned I am wondering how I can get this?