Python 调用 zip 压缩和解压
zip.exe和unzip.exe下载 放到C:\Windows\System32 下面 source =r’E:\111\test’ target_dir = ‘E:\\111\\’ targetr = target_dir + ‘test.rar’ rar_command = ‘rar a {0} {1}’.format(targetr,source) if os.system(rar_command) ==0: print(“Successful rar to”,targetr) else: print(“RAR FAILED”) targetz = target_dir + ‘test.zip’ zip_command = ‘zip -r {0} {1}’.format(targetz,source) if os.system(zip_command) ==0: print(“Successful zip to”,targetz) else: print(“ZIP FAILED”)
. Read more
