Python3通过Luhn算法快速验证信用卡卡号的代码

研发闲暇时间,将写代码过程中重要的代码段备份一下,下面的代码内容是关于Python3通过Luhn算法快速验证信用卡卡号的代码,应该对大伙有些好处。

def luhn_check(num):
    ''' Number - List of reversed digits '''
    digits = [int(x) for x in reversed(str(num))]
    return check_sum%10 == 0

if __name__ == "__main__":
    print(luhn_check(543298376))

猜你喜欢

转载自blog.csdn.net/weixin_44409623/article/details/86700931