folder_path = r'D:\juesuan' # 将此处替换为要查询的文件夹路径
file_list = []
for root, dirs, files in os.walk(folder_path):
for file in files:
full_name = os.path.join(root, file)
file_list.append(full_name)
python获致指定文件夹下的所有文件
该代码片段展示了如何使用Python的os模块遍历指定的文件夹folder_path,并将所有文件的完整路径添加到file_list中。

被折叠的 条评论
为什么被折叠?



