题目
快速生成验证码(内推码/密码 nums+alpha)
编程
import random
import string
# print(string.ascii_letters)
# print(string.ascii_uppercase)
# print(string.ascii_lowercase)
# print(string.digits)
code_str = string.ascii_letters + string.digits
print(code_str)
# print(random.sample(code_str,4))
def gen_code(len=4):
# code = ''
# for i in range(len):
# new_s = random.choice(code_str)
# code += new_s
# return code
return ''.join(random.sample(code_str,len))
print([gen_code(10) for i in range(1000)])