You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ZPyUG~珠三角地区Python用户组
我是在windows上的,把e盘的一个文件夹里的文件备份到同在e盘的另一个文件,但是却出现错误,不知道是怎么回事儿,现在把代码和错误帖在下
面。
code:
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'
error:
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
Sutra Zhou
unread,
Apr 11, 2012, 10:07:00 PM4/11/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message