import os.path
import linecache
path = r"F:\ljwdata\data\Gabiondata\anno_txt"
path_list = os.listdir(path)
path_list.sort(key=lambda x:int(x.split('.txt')[0]))
files = []
c = []
d = []
for filename in path_list:
file_names = os.path.join(filename)
str2list = file_names.split()
files.extend(str2list)
a,b=file_names.split('.')
c.append(a)
d.append(b)
i = 1
while i < 4984:
if i == float(c[i-1]):
i = i + 1
else:
print(i)
输出缺失文件序号