python把文件夹名里的空格换成下划线
import 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把文件夹名里内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复