setupActiveModules.py 文件源码

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

项目:Eyra 作者: Eyra-is 项目源码 文件源码
def logReSubn(subnExpr, preComment, postComment, errorMsg='') -> str:
    """
    Takes in the result of a re.subn call, subnExpr, and
    logs preComment to stdout, then logs postComment and specifies the
    number of subs.
    Prints errorMsg in case of 0 subs.

    Returns the string from subnExpr with replacements made.
    """
    out = subnExpr[0]
    subs = subnExpr[1]
    print(preComment)
    print(str(subs) + ' ' + postComment)
    if (subs == 0 and errorMsg != ''):
        print(errorMsg)
    return out
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号