Python不使用os.listdir打印目录中的所有文件

时间:2020-11-05 00:05:58

标签: python

enter image description here

import os


class Utilities:

    def __init__(self, filepath, archive, recursion):
        self.filepath = filepath
        self.archive = archive
        self.recursion = recursion


    def filepath(self):
        filelist = []
        filename = os.listdir(self.filepath)
        for file in filename:
            filelist.append(file)
            print(filelist)


if __name__ == '__main__':
    u = Utilities('C:\_EmailDownloader', 'C:\_EmailDownloader\_OUT', 'C:\_EmailDownloader\_ARCHIVE')
    print(u.filepath)

0 个答案:

没有答案