1. 程式人生 > >python--隨機驗證碼

python--隨機驗證碼

def check_code():
    import random
    checkcode = ''
    for i in range(6):
        current = random.randrange(0,6)
        if current != i:
            temp = chr(random.randrange(65,90))
        else:
            temp = random.randrange(0,9)
        checkcode += str(temp)
    return checkcode
code 
= check_code() print(code)