功能:读取一个文件夹中所有文件并将名称存入txt文档
参考:
https://blog.csdn.net/mao_hui_fei/article/details/109147602?utm_medium=distribute.pc_relevant.none-task-blog-baidujs_title-3&spm=1001.2101.3001.4242
https://blog.csdn.net/iluckyning/article/details/45841779
修改后可运行成功的代码:
import os
import re
images_path = 'C:\\Users\\ASUS\\Desktop\\word01\\' # 读取文件夹目录
txt_save_path = 'C:\\Users\\ASUS\\Desktop\\train.txt' # 生成的文件夹内容列表清单txt
fw = open(txt_s