(path)
Walk through all files located under a root path.
Walk through all files located under a root path.
Walk through all files located under a root path .
def iter_files(path):
    """Walk through all files located under a root path."""
    if os.path.isfile(path):
        yield path
    elif os.path.isdir(path):
        for dirpath, _, filenames in os.walk(path):
            for f in filenames:
                yield os.path.join(dirpath, f)
    else:
        raise RuntimeError('Path %s is invalid' % path)
def iter_files ( path ) : if os . path . isfile ( path ) : yield path elif os . path . isdir ( path ) : for dirpath , _ , filenames in os . walk ( path ) : for f in filenames : yield os . path . join ( dirpath , f ) else : raise RuntimeError ( 'Path %s is invalid' % path )