ehp.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:kivy_gosh 作者: mcroni 项目源码 文件源码
def match(self, *args):
        """
        It returns a sequence of objects whose attributes match.
        (key0, value0), (key1, value1), ... .

        Example:

        data = '<a size="1"><b size="1"></b></a>'
        html = Html()
        dom = html.feed(data)

        for ind in dom.match(('size', '1')):
            print ind

        It would print.

        <b size="1" ></b>
        <a size="1" ><b size="1" ></b></a>
        """

        for ind in self.sail():
            for key, value in args:
                if ind.attr[key] != value: 
                    break
            else: 
                yield(ind)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号