python 文件夹改名

import os

_dir=os.getcwd()
for f in os.listdir(_dir):
if os.path.isdir(f):
old=os.path.join(_dir, f)
new=old.replace('-', '_')
os.rename(old,new)

 

posted @ 2022-06-14 10:08  笨笨和呆呆  阅读(66)  评论(0)    收藏  举报