ehp.py 文件源码

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

项目:kivy_gosh 作者: mcroni 项目源码 文件源码
def walk(self):
        """
        Like sail but carries name and attr.

        Example:

        html = Html()
        data = '<body> <em> This is all the text.</em></body>'
        dom = html.feed(data)

        for ind, name, attr in dom.walk():
            print 'TAG:', ind
            print 'NAME:', name
            print 'ATTR:', attr

        It should print.

        TAG:  
        NAME: 1
        ATTR: 
        TAG:  This is all the text.
        NAME: 1
        ATTR: 
        TAG: <em > This is all the text.</em>
        NAME: em
        ATTR: 
        TAG: <body > <em > This is all the text.</em></body>
        NAME: body
        ATTR: 
        """

        for ind in self.sail():
            yield (ind, ind.name, ind.attr)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号