get file list of files contained in a zip file

前端 未结 3 1613
慢半拍i
慢半拍i 2020-12-13 07:57

I have a zip archive: my_zip.zip. Inside it is one txt file, the name of which I do not know. I was taking a look at Python\'s zipfile

3条回答
  •  醉梦人生
    2020-12-13 08:51

    What you need is ZipFile.namelist() that will give you a list of all the contents of the archive, you can then do a zip.open('filename_you_discover') to get the contents of that file.

提交回复
热议问题