python random生成随机验证码

import random
List = []

for i in range(6):
    if i == random.randint(0,5):
        s = random.randint(0,9)
        List.append(str(s))
    else:
        a = chr(random.randint(65,90))
        List.append(a)
print(List)
print("".join(List))

猜你喜欢

转载自blog.csdn.net/qq_38125626/article/details/81106288