python小程序

-- 批量给文件夹重命名

import os

path = 'C:\\Users\\tylerzhu\\Desktop\\icon'

for file in os.listdir(path):

    if os.path.isfile(os.path.join(path,file))==True:

     newname = file.replace("scroll_1", "scroll_00")

        os.rename(os.path.join(path,file),os.path.join(path,newname))

        print(file)

posted @ 2020-08-28 17:31  噜啦啦zyq  阅读(132)  评论(0编辑  收藏  举报