生成随机数

# 应用,随机验证码

def make_code(size=4):
    res = ''
    for i in range(size):
        res1 = chr(random.randint(65, 90))
        res2 = str(random.randint(0, 9))
        res += random.choice([res1, res2])
    return res

print(make_code(12))

 

posted @ 2020-10-26 20:46  jcclty  阅读(94)  评论(0编辑  收藏  举报