from os.path import basename, isdir from os import listdir def traverse(path, depth=0): print depth* '| ' + '|_', basename(path) if(isdir(path)): for item in listdir(path): traverse(path+'/'+item, depth+1) if __name__ == '__main__': traverse('./')
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/8513.html