attr_starts_with

returns True if the attribute value starts with the given value.

Arguments

Source


def attr_starts_with(self, attr, value):
    a = self.attr(attr)
    if a is not None:
        starts = re.compile(value)
        if starts.match(a) is not None:
            return True
    return False