import os
import shutil
files = os.listdir("../code")
data = "trackrate"
target_path = "../code/1/"
for file in files:
if data in file:
src_file = "../code/" + file
if os.path.isfile(src_file):
if not os.path.exists(target_path):
os.mkdir(target_path)
shutil.move(src_file,target_path)
【Python】利用字段对文件分类
最新推荐文章于 2024-08-23 16:53:34 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)