Python 随机验证码

import random

#print random.randint(1,3)
#print random.randrange(1,10,2)

def chek_code():
checkcode= ''
for i in range(6):
current=random.randrange(0,6)
if current != i:
temp=chr(random.randint(65,90))
else:
temp = random.randint(0,9)
checkcode += str(temp)
return checkcode
print chek_code()
def check_code1(a):
if a == chek_code():
print 'Hello'
else:
print 'Error'
chek_code()
check_code1(raw_input('Please you check code:'))
posted @ 2016-04-08 14:58  FreeMan1  阅读(155)  评论(0编辑  收藏  举报