标签:class for style move 收集 练习 files listdir exist
import os import shutil path=‘./‘ files = os.listdir(path) for f in files: folder_name = ‘./‘ + f.split(‘.‘)[-1] if not os.path.exist(path): os.makedirs(folder_name) shutil.move(f,folder_name) else: shutil.move(f,folder_name)
标签:class for style move 收集 练习 files listdir exist
原文地址:https://www.cnblogs.com/Erick-L/p/9178939.html