批量更名

来源:互联网 发布:js防水涂料是柔性的吗 编辑:程序博客网 时间:2024/06/11 03:09
#!/usr/bin/eny python3#-*- coding:utf-8 -*-import osimport repath=r'C:\Users\Administrator\Desktop\权利的游戏'for item in os.scandir(path):    # print(item.path)    old_name=item.path    new_name=re.sub(r'权L的Y戏 (\w+)( 关注 微信公众号 amc127 )(\w+) .MKV','权力的游戏 \g<1> \g<2>.MKV',old_name)    # print(new_name)    # item.name = new_name    os.rename(old_name,new_name)

0 0