问题描述
Sysinfo = open('System@R_563_404[email protected]','w')
Sysinfo.write("something useful",)
Sysinfo.close
#a handful more processes occur here
os.chdir(dstFolder)
shutil.make_archive('filename','zip',srcFolder)
我有上面的代码,除了我创建的System@R_563_404[email protected]文件外,其他所有内容都可以正常压缩。当我解压缩.zip文件后将其打开时,它是完全空白的。对我来说奇怪的是,在压缩之前,源文件夹中的同一文件是完全可以的。
解决方法
确保正确调用函数。您缺少以下内容:
Sysinfo.close()