import os
file_data1 = []
with open("temp1.txt", "w") as f:
for file_name in os.listdir("./JPEGImages"):
file_data1.append(file_name)
#file_data1 = file_data1.sort() #error
data1 = ""
for temp in sorted(file_data1):
data1 = data1 + temp + "\n"
f.write(data1)
file_data2 = []
with open("temp2.txt", "w") as f:
for file_name in os.listdir("./Annotations"):
file_data2.append(file_name)
#file_data2 = file_data2.sort() #error
data2 = ""
for temp in sorted(file_data2):
data2 = data2 + temp + "\n"
f.write(data