import os import os.path path =os.getcwd() listdir =os.listdir(path) html =[] for dirs in listdir: if (dirs[-1]=="l") and (dirs[0].isnumeric()): html.append(dirs) html.sort() print(html) k=0 for item in html: if 0下一页\n') f.write('\n上一页\n') k = k+1 print("end!")