python递归遍历目录中的所有文件,打印出所有文件(两种方法):

import os
rootDir = 'C:\\zabbix\\'
def Test1(rootDir):
    for root,dirs,files in os.walk(rootDir):
        for filespath in files:
            print os.path.join(root,filespath)
import os
def Test2(rootDir):    
    for lists in os.listdir(rootDir):        
        path = os.path.join(rootDir, lists)
        print path
        if os.path.isdir(path):
            Test2(path)


p_w_picpath