import random item = '' for i in range(6): num1 = random.randint(0,9) if num1 < 5: num =str(random.randint(0,9)) item += num else: zm = random.randint(65,91) zm = chr(zm) item += zm #chr()将数字变成对应的字母 ord()将字母变成对应的数字 print(item)
import random item = '' for i in range(6): num1 = random.randint(0,9) if num1 < 5: num =str(random.randint(0,9)) item += num else: zm = random.randint(65,91) zm = chr(zm) item += zm #chr()将数字变成对应的字母 ord()将字母变成对应的数字 print(item)