随机验证码(5位数字与字母混合)

View Code
 1 import random
 2 
 3 def v_code():
 4  
 5     ret=" "
 6     for i in range(5):
 7         num=random.randint(0,9)
 8         alf=chr(random.randint(65,122))
 9         s=str(random.choice([num,alf]))
10         ret+=s
11     return ret
12 
13 print(v_code())
posted @ 2019-06-17 10:54  晓亮86  阅读(428)  评论(0)    收藏  举报