验证码的实现py3

import random
flag = 1
try_=0
while (flag):
try_ +=1
yan = ""
for i in range(0,4):
cun=random.randrange(1,4)
if cun==i:
tmp=chr(random.randint(65,90))
else:
tmp=random.randrange(0,9)
yan+=str(tmp)
print(yan)
var=input("请输入验证码:")
if var == yan:
print('验证成功')
break
else:
print("验证失败")
if try_ == 3:
print("输入次数超3过次,请过会儿再试...")
break
孰能生巧
posted @ 2018-07-12 00:00  jum_blog  阅读(186)  评论(0编辑  收藏  举报

载入天数...载入时分秒...