ehp.py 文件源码

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

项目:kivy_gosh 作者: mcroni 项目源码 文件源码
def index(self, item):
        """
        This is similar to index but uses id
        to check for equality.

        Example:

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

        for root, ind in dom.sail_with_root():
            print root.name, ind.name, root.index(ind)


        It would print.

        a b 0
        a b 1
         a 0        

        The line where it appears ' a 0' corresponds to the
        outmost object. The outmost object is an instance of Root
        that contains all the other objects.
        """

        count = 0
        for ind in self:
            if ind is item: return count
            count = count + 1

        raise ValueError
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号