python实现拷贝指定文件到指定目录

python实现这个功能非常简单,因为库太强大了

import os
import shutil
alllist=os.listdir(u"D:\notes\python\资料\")
for i in alllist:
    aa,bb=i.split(".")
    if 'python' in aa.lower():
        oldname= u"D:\notes\python\资料\"+aa+"."+bb
        newname=u"d:\copy\newname"+aa+"."+bb
        shutil.copyfile(oldname,newname)
原文地址:https://www.cnblogs.com/xueli/p/4930452.html