网站更新内容:请访问: https://bigdata.ministep.cn/

python 文件名批量修改

文件名批量修改

"""
文件名批量修改
示例:尚硅谷2021版React技术全家桶全套完整版(零基础入门到精通-男神天禹老师亲授) (P1. 001_尚硅谷react教程_react简介).mp4
"""
import os, re, shutil
dst_dir  = r"G:\FFOutput\react_shangguigu"  #replace \ with /
os.chdir(dst_dir)
file_list = os.listdir(dst_dir)
for file in file_list:
    new_name = re.findall(r'P.*?\.mp4$',file)  # \u4E00-\u9FA5
    if len(new_name)>=1:
        print(new_name)
        os.rename(file,new_name[0])
    
    #    shutil.move(os.path.join(dst_dir,file),os.path.join(dst_dir,new_name[0]+new_name[1]))


关键词
bili B站 you-get 重命名

posted @ 2021-11-22 09:06  ministep88  阅读(37)  评论(0编辑  收藏  举报
网站更新内容:请访问:https://bigdata.ministep.cn/