# 应用,随机验证码 def make_code(size=4): res = '' for i in range(size): res1 = chr(random.randint(65, 90)) res2 = str(random.randint(0, 9)) res += random.choice([res1, res2]) return res print(make_code(12))