python 读取文件夹中所有txt文件

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)
posted @ 2022-08-25 19:59  小柴i  阅读(386)  评论(0编辑  收藏  举报