#!usr/bin/env python
# -*- coding:utf-8 -*-
"""
@author: 86151
@file: tree.py
@time: 2021/04/03
@desc:
"""
#递归打印所有的目录和文件
import os
allfiles=[]
def getAllFiles(path,level):
childFiles=os.listdir(path)
for file in childFiles:
filepath=os.path.join(path,file)
if os.path.isdir(filepath):
getAllFiles(filepath,level+1)
allfiles.append("\t"*level+filepath)
getAllFiles("Day_1",0)
for f in reversed(allfiles):
print(f)
07-09
246