select

returns elements that have the selected attribute.

Arguments

Source


def select(self, attr):
    ret = pyNodeList()
    for node in self:
        a = node.attr(attr)
        if a is not None:
            ret.append(node)
    if len(ret) == 1: return ret[0]
    else: return ret