Python 生成 6 位随机验证码 (数字和大写字母)
import random import string
def generate_code(): code = '' for i in range(6): if random.randint(0, 1): code += random.choice(string.digits) else: code += random.choice(string.ascii_uppercase) return code
print(generate_code())
原文地址: https://www.cveoy.top/t/topic/j7SL 著作权归作者所有。请勿转载和采集!