ehp.py 文件源码

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

项目:kivy_gosh 作者: mcroni 项目源码 文件源码
def sail(self):
        """ 
        This is used to navigate through the xml/html document.
        Every xml/html object is represented by a python class
        instance that inherits from Root.

        The method sail is used to return an iterator
        for these objects.

        Example:
        data = '<a> <b> </b> </a>'

        html = Html()
        dom = html.feed(data)

        for ind in dom.sail():
            print type(ind),',', ind.name

        It would output.

        <class 'ehp.Root'> , a
        <class 'ehp.Root'> , b
        """

        for indi in self[:]:
            for indj in indi.sail():
                yield(indj)

            yield(indi)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号