直接上代码 :
import os
def Get_Res_All_File_Name(Res_dir):
All_File_Type = set()
for root, dirs, files in os.walk(Res_dir):
#root_dir = Father Dir
#sub_dir = Son Dir
#files = This dir all files
#print('sub_dirs:', dirs)
#print('root_dir:', root)
#print('files:', files)
for file in files:
#print (root+"/"+file)
file = str(file)
file_index = file.rfind(".")
if file_index != -1 :
file_name = file[file_index:len(file)]
All_File_Type.add(file_name)
return All_File_Type
for Type_name in Get_Res_All_File_Name("E:/FOOK/Project"):
print(Type_name)