#!/usr/bin/python

from os.path import basename, isdir
from os import listdir

def traverse(path, depth=0):
    prefix 
= depth* '' + '|_'
    
if(isdir(path)):
        
print prefix, basename(path)
        
for item in listdir(path):
            traverse(path
+'/'+item, depth+1)
    
else:
        
print prefix, basename(path)

if __name__ == '__main__':
    traverse(
'./')
 

 

相关文章:

  • 2021-06-26
  • 2021-11-28
  • 2022-12-23
  • 2021-10-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-17
  • 2021-11-23
  • 2022-03-02
  • 2021-11-27
  • 2021-10-22
相关资源
相似解决方案