import os
import re
import string
path = os.getcwd()
print("current file path",path)
files = os.listdir('D:\\1')
for name in files:
a = os.path.splitext(name)
if a[1] == '.txt':
newname = a[0]+'.py'
print (name,newname)
os.rename(name,newname)
pyhon3 文件名批量转换
猜你喜欢
转载自blog.csdn.net/weixinyi21cn/article/details/49834755
今日推荐
周排行