#python随机生成包含字母数字的六位验证码
import random
def v_code():
ret = ""
for i in range(6):
num = random.randint(0, 9)
# num = chr(random.randint(48,57))#ASCII表示数字
letter = chr(random.randint(97, 122))#取小写字母
Letter = chr(random.randint(65, 90))#取大写字母
s = str(random.choice([num,letter,Letter]))
ret += s
return ret
print(v_code())
python随机生成包含字母数字的六位验证码
最新推荐文章于 2024-09-04 11:21:44 发布