import os path = 'D:/DeepLearning/data/tf_unet/label/' file_names = os.listdir(path) for temp in file_names: img = os.path.join(path, temp) fname, ext = os.path.splitext(img) base_name = os.path.basename(fname) new_n = base_name + '_mask' + ext print(os.path.join(path, new_n)) os.rename(os.path.join(path, temp), os.path.join(path, new_n))
Python批量给文件名加后缀
最新推荐文章于 2024-06-05 17:42:24 发布