给出目录下包括子目录所有文件的绝对路径,目录绝对路径,import osdef


import osdef GetAllFile(way=""):    Dir=[]    File=[]    mdi=os.listdir(way)    for i in mdi:        j=os.path.join(way,i)        if os.path.isfile(j):            File.append(j)        elif os.path.isdir(j):            Dir.append(j)    if Dir:        for i in Dir:            File.extend(GetAllFile(i))    return Fileif __name__=="__main__":    print """Function GetAllFile(way=""),get path,return a list of all files in the path and its children path"""    raw_input("Press Any Key To Exit...")#该片段来自于http://byrx.net

评论关闭