emailControl.py 文件源码

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

项目:SWCheckIn 作者: gsugar87 项目源码 文件源码
def getConfNum(msgText):
    # get the confirmation number
    if 'confNum=' in msgText:
        strIndexStart = msgText.find('confNum=')+8
        strIndexEnd = strIndexStart+6
        confNum = str(msgText[strIndexStart:strIndexEnd])
    else:
        # get dictionary
        d = enchant.Dict("en_US")
        pattern = re.compile(r'(?<![A-Za-z0-9])[A-Z0-9]{6}(?![A-Za-z0-9])')
        msgTextConfNumSearch = msgText[200:]
        regExSearch = pattern.search(msgTextConfNumSearch)
        while regExSearch:
            # see if the found string is a real word
            possibleConfNum = regExSearch.group()
            if not d.check(possibleConfNum):
                confNum = str(possibleConfNum)
                break
            else:
                msgTextConfNumSearch = msgTextConfNumSearch[regExSearch.end():]
                regExSearch = pattern.search(msgTextConfNumSearch)
    return confNum
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号