python把文件夹名里的空格换成下划线
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13import os def rm_space(): for f in os.listdir("."): if f.find(" ") > 0: n = f.replace(" ", "_") if n != f: os.rename(f, n) else: os.rename(f, "_"+n) rm_space()
最后
以上就是安静吐司最近收集整理的关于python把文件夹名里的空格换成下划线python把文件夹名里的空格换成下划线的全部内容,更多相关python把文件夹名里内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复