代码语言:javascript复制
file_dir = os.path.abspath('.') "/MarkCoin"
def zip_ya():
L = []
for root, dirs, files in os.walk(file_dir):
for file in files:
if os.path.splitext(file)[1] == '.png' or os.path.splitext(file)[1] == '.xlsx':
L.append(file)
z = zipfile.ZipFile(file_dir11 'aa_file.zip', 'w')
for i in range(len(L)):
z.write(file_dir11 L[i])
z.close()
if __name__ == '__main__':
zip_ya()