#生成四位随机数 import random a = "" for i in range(0,4): i = random.randint(1,9) a = a+str(i) print(a)
#随机生成四位字母加数字 import random a = "" for i in range(0,4): b = random.randint(0,4) if i == b: c = random.randint(1,9) a = a+str(c) else: c = chr(random.randint(65,90)) a = a + str(c) print(a)
chr(random.randint(65,90))#随机选取一个大写字母
chr(random.randint(97,122))#随机选取一个小写字母
random.choice([chr(random.randint(65,90)),chr(random.randint(97,122))])
每天进步一点