代码拉取完成,页面将自动刷新
import random
import sys
articles = ["一个", "一只"]
subjects = ["小猫", "小狗", "小马", "小孩"]
verbs = ["唱歌", "跳舞", "奔跑", "思考", "倾听", "划船"]
adverbs = ["轻轻地", "快乐地", "安静地", "悲伤地"]
lines = 50
if len(sys.argv) > 1:
try:
temp = int(sys.argv[1])
if 1 <= temp <= 10:
lines = temp
else:
print("lines must be 1-10 inclusive")
except ValueError:
print("usage: badpoetry.py [lines]")
while lines:
article = random.choice(articles)
subject = random.choice(subjects)
verb = random.choice(verbs)
if random.randint(0, 1) == 0:
print(article, subject, verb)
else:
adverb = random.choice(adverbs)
print(article,subject,verb,adverb)
lines -= 1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。