**行有什么问题? "打印"以上工作正常。
import os
import time
import shutil
def trace_pdf_ppt(directory):
try:
flag = False
assert os.path.isdir(directory)
target = os.path.join('/Users/yanlu/Desktop/', "pptPdf"+time.strftime('%Y%m%W'))
print("target", target)
if not os.path.exists(target):
os.mkdir(target)
for root, dirs, files in os.walk(directory, topdown=True):
for fl in files:
print(fl)
if fl.split('.')[-1] == "pdf" or fl.split('.')[-1] == 'ppt' or fl.split('.')[-1] == 'pptx':
print("copy successfully")
**shutil.copy(fl, target)**
flag = True
if not flag:
print("No ppt or pdf.")
return target
except:
print("Trace Error")
return ''