Search code examples
pythonpython-3.xzipfilepathpython-zipfile

How to get the filepath of a ZipFile object?


If I have a zipfile.ZipFile object, how can I determine the file path of the zip file from the object?

a = zipfile.ZipFile('C:\\path\\zipfile.zip')

a.get_file_path()

where get_file_path() should return 'C:\\path\\zipfile.zip'.


Solution

  • You can access it using filename attribute:

    a.filename