这是一个常用的功能,可以有两种方法,os.walk
和os.listdir
文档是这么解释的:
os.listdir(path)
Return a list containing the names of the entries in the directory given by path. The list is in arbitrary order. It does not include the special entries ‘.’ and ‘..’ even if they are present in the directory.