import random check=‘‘ for num in range(4): i = random.randrange(1,3) #随机生成1或者2 if i%2==0: #判断后选择生成字母 check_num = random.randrange(65,91) check_str = chr(check_num) check=check + check_str else: #生成数字 check_num = random.randrange(49,58) check_str = chr(check_num) check=check + check_str print (check)
时间: 2024-11-05 19:40:36