六位数随机验证 sms_code.py

#!/usr/bin/python env
# coding:utf-8 import random def code(num=6):
res = ""
for i in range(num):
# 数字0-9
num1 = str(random.randint(0, 9))
# 大写字母A-Z
# a = chr(random.randint(65, 90))
# 小写字母a-z
# b = chr(random.randint(97, 122))
# res += random.choice([num1, b])
res += random.choice([num1])
return res a = code()
print(a)
上一篇:【IT笔试面试题整理】给定一个数组a[N]构造数组b [N]


下一篇:单用户模式下修改root密码