import os
dir="/home/yuejian/Desktop/TFRecord/train_data" # 图片和txt文件的位置
def findtxt(path, ret):
"""Finding the *.txt file in specify path"""
filelist = os.listdir(path)
for filename in filelist:
de_path = os.path.join(path, filename)
if os.path.isfile(de_path):
if de_path.endswith(".txt"): # Specify to find the txt file.
ret.append(de_path)
else:
findtxt(de_path, ret)
找到文件夹下所有txt文件
最新推荐文章于 2021-02-13 04:27:54 发布