一个文件备份程序有错
程序代码:
import os import time source=[r'e:\backup'] target_dir=[r'e:\satan'] today=target_dir+time.strftime('%Y%m%d') now=time.strftime('%H%M%S') if not os.paht.exists(today): os.mkdir(today) print 'successfully created directory',today target=today+os.sep+now+'.zip' zip_command="zip -qr '%s' %s" %(target,' '.join(source)) if os.system(zip_command)==0: print 'successful backup to',target else: print 'back failed'出现的错误是:
Traceback (most recent call last):
File "C:/Users/fenghelong/Desktop/python操作/backup_ver2.py", line 5, in <module>
today=target_dir+time.strftime('%Y%m%d')
TypeError: can only concatenate list (not "str") to list