随机码

#随机验证码
import random
def v_code():
    code=''
    for i in range(5):
        num = random.randint(0,9)
        alf =chr(random.randint(65,90))
        add = random.choice([num,alf])
        code+=str(add)
    return code
print(v_code())

 

posted @ 2017-01-06 19:04  打不死的--蟑螂  阅读(155)  评论(0编辑  收藏  举报