列出指定目录下特定扩展名的某类文件
import os
if data_path: # data_path is a given directory
data_filenames = []
for f in os.listdir(data_path):
if f.endswith('.csv'): # list all csv files in the directory
data_filenames.append(f)
else:
print('No directory chosen')