import os
# 图片文件夹路径
pic_paths= "D:/sample/neg"
f=open('neg.txt', 'w')
filenames=os.listdir(pic_paths)
filenames.sort()
for filename in filenames:
# 图片绝对路径
out_path="D:/sample/neg/" + filename
print(out_path)
f.write(out_path+'\n')
f.close()