if/else
对只有部分工作的命令有一些问题。当脚本运行时,如果 是 ,它将完成该if
部分name == check_file
,但如果它是假的,它只是跳过该else
语句并移至下一个任务。以下是无法正常运行的代码部分:
for name in zip_file_names:
copy_to = copy_this.get(name)
if copy_to is not None:
source_file = os.path.join(r'\\svr-dc\ftp site\%s\daily' % item, name)
destination = os.path.join(r"C:\%s" % item, copy_to)
shutil.copy(source_file, destination)
print name, "has been verified and copied."
elif copy_to is not None:
print "%s has been completed." % item
else:
print "Repoll %s for %s" % (item, business_date_one)
print "Once information is downloaded press any key."
re_download = raw_input(" ")
ext_ver_cop_one()
最后else
是针对操作不需要的已解压缩文件名,因此我必须传递它们,但我不明白为什么该语句的if/else
内部if/else
无法正常运行。特别是因为这if
部分工作正常。想法?