ayuLiao
5/23/2018 - 2:19 AM

python生成六位数字的验证码

生成六位数字的验证码

from random import choice

def generate_code(self):
    """
    生成六位数字的验证码
    :return:
    """
    seeds = "1234567890"
    random_str = []
    for i in range(6):
      random_str.append(choice(seeds))
    return "".join(random_str)