wordnet.py 文件源码

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

项目:rensapy 作者: RensaProject 项目源码 文件源码
def _index(key, sequence, testfn=None, keyfn=None):
    """Return the index of key within sequence, using testfn for
    comparison and transforming items of sequence by keyfn first.

    >>> _index('e', 'hello')
    1
    >>> _index('E', 'hello', testfn=_equalsIgnoreCase)
    1
    >>> _index('x', 'hello')
    """
    index = 0
    for element in sequence:
    value = element
    if keyfn:
        value = keyfn(value)
    if (not testfn and value == key) or (testfn and testfn(value, key)):
        return index
    index = index + 1
    return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号