itb_util.py 文件源码

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

项目:ibus-typing-booster 作者: mike-fabian 项目源码 文件源码
def lstrip_token(token):
    '''Strips some characters from the left side of a token

    Characters which have a type listed in CATEGORIES_TO_STRIP_FROM_TOKENS
    are stripped from the left side of a token.

    The stripped token is returned.

    :param token: The token where characters may be stripped from
    :type token: String
    :rtype: String

    Examples:

    >>> lstrip_token(".'foo'.")
    "foo'."
    '''
    token = token.lstrip()
    while (len(token) > 0
           and
           unicodedata.category(token[0]) in CATEGORIES_TO_STRIP_FROM_TOKENS):
        token = token[1:]
    return token
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号