问题:
下载的迅雷文件名不顺眼,批量修改下文件名,写了个很简单的重命名的python脚本re_name.py,很方便。
修改前:
修改后:
- #!\usr\bin\env python
- # -*- coding: utf-8 -*-
- #Filename:re_name.py
- import os
- path = os.getcwd()
- for file in os.listdir(path):
- if file.split('.',)[-1] != 'py':
- index1 = '[迅雷免费高清下载].'
- index2 = '__480P标清'
- f1 = file.split(index1,)[1]
- f2 = f1.split(index2,)
- newfile = f2[0] + f2[1]
- os.rename(file,newfile)