def show_txt(): file_lst = os.listdir(LOG_DIR) txt_lst = [x for x in file_lst if x.find('.txt') != -1] txt_lst.sort(reverse=True) print(txt_lst)