python 生成驗證碼

import random
verifycode = ''
for i in range(6):
    current = random.randrange(0,6)
    if current != i and current+1 != i:
        tmp = chr(random.randint(65,90))
    elif current+1 == i:
        tmp = chr(random.randint(97,122))
    else:
        tmp = random.randint(0,9)
    verifycode += str(tmp)
print(verifycode)
相關文章
相關標籤/搜索