python 获取某个文件下的所有文件

1 import os
2 files = os.listdir(load_Graph_file_path)
3     cnt = 0
4     for file in files:
5         print(file)
6         if (os.path.splitext(file)[0][0] == 'G' and os.path.splitext(file)[1] == '.npy' ):
7             all_Graph[cnt] = np.load(load_Graph_file_path+'/'+file).item()
8             cnt = cnt + 1

 

posted on 2019-07-26 14:52  若流芳千古  阅读(622)  评论(0编辑  收藏  举报

导航