list_files_in_zip.py
来自「学习Pyhton脚本的源代码」· Python 代码 · 共 23 行
PY
23 行
#------------------------------------------------------------------------------
# Name: list_files_in_zip.py
# Author: Kevin Harris (kevin@codesampler.com)
# Last Modified: 02/13/04
# Description: This Python script demonstrates how to use zipfile to list
# the files contained in a zip archive.
#------------------------------------------------------------------------------
import zipfile
myZipFile = zipfile.ZipFile( "test.zip", "r" )
# List all files contained within the zip file
for fileName in myZipFile.namelist():
print fileName
print
# List file information
for info in myZipFile.infolist():
print info.filename, info.date_time, info.file_size
raw_input( '\n\nPress Enter to exit...' )
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?