我现有的代码(一个部分)在这篇文章的底部被借用。在
我想做的是从zip文件的内的一个目录中提取所有文件。不是zip文件的全部内容,而是zip中目录(/theme_files/
)中的文件。我已经引进了必要的图书馆。在
将文件从[filename].tpk/theme_files
提取到./workspace/[output]/
(.tpk
=.zip
)
theme_zip = zipfile.ZipFile(current_dir + "/themes/" + theme_name + ".tpk", 'r')
theme_zip.extractall(output_dir)
theme_zip.close()
您可以使用^{} 并使用对从^{} 返回的文件名的列表理解来设置}参数:
path
和{使用regex搜索特定子文件夹中的文件名。+逐个文件提取它们:
相关问题 更多 >
编程相关推荐