标签:copy als 循环 return false -- 深度 判断目录 sys
#!/usr/bin/env python def func(n): if n == 0: return 1 else: return n * func(n-1) print func(5)
#!/usr/bin/env python def func(n): sum = 0 if n == 0: return 0 else: return n + func(n-1) print func(100)
#!/usr/bin/env python import os import sys def listdir(n): lsdir = os.listdir(n) for i in lsdir: if os.path.isfile(os.path.join(n,i)): print os.path.join(n,i) else: listdir(os.path.join(n,i)) listdir(sys.argv[1])
#!/usr/bin/env python import os import sys def print_file(path): lsdir = os.listdir(path) files = [ i for i in lsdir if os.path.isfile(os.path.join(path,i)) ] dicts = [ i for i in lsdir if os.path.isdir(os.path.join(path,i)) ] if files: for i in files: print os.path.join(path,i) if dicts: for f in dicts: print_file(os.path.join(path,f)) print_file(sys.argv[1])
标签:copy als 循环 return false -- 深度 判断目录 sys
原文地址:https://www.cnblogs.com/anzhangjun/p/9021992.html