首页 > 代码库 > 实现随机验证码

实现随机验证码

          实现随机验证码

 1 #生成随机验证码
 2 import random
 3 temp = ""
 4 for i in range(6):
 5     num = random.randrange(0,4)
 6     if num == 1 or num == 3:
 7         rad2 = random.randrange(0,9)
 8         temp = temp + str(rad2)
 9     else:
10         rad1 = random.randrange(65,91)
11         c1 = chr(rad1)
12         temp = temp + c1
13 print(temp)

 

实现随机验证码