python doc操作
标签(空格分隔): Python
1.源代码
#!C:\Users\spfhy\AppData\Local\Programs\Python\Python36-32\python.exe
#coding=gbk
import os
def rename():
count = 0
path = r"C:\Users\spfhy\Desktop\rename"
filelist = os.listdir(path)
for file in filelist:
oldDir = os.path.join(path,file)
if os.path.isdir(oldDir):#如果是文件夹,则跳过
continue
filetype = os.path.splitext(file)[1]#扩展名
newDir = os.path.join(path,'cell'+str(count)+filetype)
os.renames(oldDir, newDir)
count += 1
rename()
print('rename success')
2.操作方法
- cmd–>拖拽.py脚本至cmd窗口–>enter即可1
目录
用 [TOC]
来生成目录:
- 一定要安装python3,且正确设置环境变量 ↩