主代码:
# coding=utf-8
import os
import time
source = ['D:\\Users\\Administrator\\Desktop\\chengqiyiliao.pdf'];
target_dir = ['D:\\Users\\Administrator\\Desktop\\yx'];
target = target_dir[0] +'\\'+ time.strftime('%Y%m%d%H%M%S') + '.zip'
print(target)
zip_command = "zip -qr %s %s" % (target,' '.join(source))
print(zip_command)
print(os.system(zip_command))
if os.system(zip_command)== 0:
print('Successful backup to',target)
else:
print('Backup FAILED')
运行报错:
"C:\Program Files\Anaconda3\python.exe" C:/Users/Administrator/untitled1/pandas01.py
D:\Users\Administrator\Desktop\yx\20180422144455.zip
zip -qr D:\Users\Administrator\Desktop\yx\20180422144455.zip D:\Users\Administrator\Desktop\chengqiyiliao.pdf
'zip xxxxxxxxxxx'
Backup FAILED
程序是在windows7环境下pycharm上运行,路径都没问题,直接运行报错,求指导!
1 个解决方案
#1
百度搜相关关键字。
#1
百度搜相关关键字。