1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
| import random
typ = input("请输入选择: 1.五言 2.七言") data = [ '垂杨', '新柳', '玉丝纶', '金嫩', '柔条', '曲岸垂杨', '柳丝', '闲柳', '千花万柳', '花海', '芳甸吐嫩', '摇绿', '绿卷', '浓翠', '横翠', '金碧', '舒卷款款', '片片', '缕缕', '落纷纷新晴', '笼晴', '韶光', '婉媚', '温丽', '芊绵', '春华', '空灵', '春柔', '清婉', '馨烈', '和婉', '清蕊', '清芬', '素约', '红素', '旖旎飞花', '浮花', '落英', '花影', '芳丛', '浮香', '锦花', '绣草', '烂漫', '芳踪', '镂玉', '雕琼', '繁枝', '素景', '密叶', '稠花点水', '扑面', '风轻', '水胧', '倚暖胭脂色', '水溶溶', '不留痕', '几点春', '邀春驻', '花映柳', '花深浅', '树高低', '翻微风', '香接天浓露飘香', '软软东风', '水逝云卷', '繁花盈枝', '百卉团团', '和风轻暖', '春光满树', '秀色灼灼', '红尘倦客', '柳带摇风', '香坠庭户', '水阔花飞', '瘦叶和风', '叶叶心心', '眼迷魂牵', '浅粉深红', ]
def choose_word(num): chose = [] for i in range(num): chose.append(random.choice(data)) return chose
if int(typ) == 1: sentence_list = [] for i in range(10): chose = choose_word(2) while len(chose[-1]) + len(chose[-2]) != 5: chose = choose_word(2) if len(chose[-1]) == 2 and len(chose[-2]) == 3: sentence_list.append(chose[-1] + chose[-2]) elif len(chose[-1]) == 3 and len(chose[-2]) == 2: sentence_list.append(chose[-2] + chose[-1]) print(sentence_list)
elif int(typ) == 2: sentence_list = [] for i in range(10): chose = choose_word(3) while len(chose[-1]) + len(chose[-2]) != 7: chose = choose_word(3) sentence_list.append(chose[-1] + chose[-2]) print(sentence_list)
|