如何快速的获取文件夹目录下的所有文件路径
import os
#define the work path
work_path = r'H:\'
# define a function to get the every files name in the work path
def get_file_name(work_path):
file_name = []
for root, dirs, files in os.walk(work_path):
for file in files:
file_name.append(work_path + '\\' + file)
return file_name
path = get_file_name(work_path)
print(path)