首页 > 代码库 > 随机生成验证码import random

随机生成验证码import random

 1 #!/usr/bin/env python
 2 import random
 3 temp = ""
 4 for i in range(6) :
 5     num = random.randrange(0, 4)
 6     if num == 3 or num == 1 :
 7         rad2 = random.randrange(0, 10)
 8         temp = temp + str(rad2)
 9     else :
10         rad1 = random.randrange(65, 91)
11         c1 = chr(rad1)
12         temp = temp + c1
13 print(temp)

 

随机生成验证码import random