标签:
#!\usr\bin\env python # -*- coding: utf-8 -*- import os def printFiles(folder): #获取当前路径下所有文件 fileList = os.listdir(folder) for file in fileList: # 如果不是是路径 # if not os.path.isdir(file): # 如果是路径,就打印出来 if os.path.isdir(file): #格式化输出 print(‘===%s===‘ % file) printFiles(file) else: print(‘文件:\t‘,file) #获取当前路径 curPath = os.getcwd() printFiles(curPath)
标签:
原文地址:http://www.cnblogs.com/pengzhong/p/PythonPath.html