首页 > 代码库 > python 验证码

python 验证码

python写的验证码小程序

##################验证码,数字+字母
import random
check_code=""
for i in range(6):
    code_number = random.randint(0,9)
    if random.randint(0,1) == 0:
        codestr_number = random.randint(65,90)
        codestr_number = chr(codestr_number)
        check_code = check_code + str(codestr_number)
    else:
        check_code = check_code + str(code_number)
print (check_code)



##################验证码数字
import random
check_code=""
for i in range(6):
    code_number = random.randint(0,9)
    check_code = check_code + str(code_number)
print (check_code)

  

python 验证码