打印田字格随机数(全随机)
1 import random as rd 2 list_b = list() 3 for i in range(48,58): 4 list_b.append(chr(i)) 5 for i in range(65,91): 6 list_b.append(chr(i)) 7 for i in range(97,123): 8 list_b.append(chr(i)) 9 def random_str1(): 10 words_1 = "ddddddddddddddddd" 11 list_c = list(words_1) 12 for i in range(0,17): 13 list_c[i] = str(rd.choice(list_b)) 14 words_1 = ''.join(list_c) 15 return words_1 16 def random_str2(): 17 words_2 = "d d d" 18 list_d = list(words_2) 19 list_d[::8] = [str(rd.choice(list_b)),str(rd.choice(list_b)),str(rd.choice(list_b))] 20 words_2 = ''.join(list_d) 21 return words_2 22 print() 23 for i in range(2): 24 print(random_str1()) 25 print(random_str2()) 26 print(random_str2()) 27 print(random_str1()) 28 print()