python版恶俗古风自动生成器.py
2016-04-12 17:30
411 查看
python版恶俗古风自动生成器.py
""" python版恶俗古风自动生成器.py 模仿自: http://www.jianshu.com/p/f893291674ca 2016年4月4日 18:37:31 codegay """ from random import sample import time import os words="""朱砂 天下 杀伐 人家 韶华 风华 繁华 血染 墨染 白衣 素衣 嫁衣 倾城 孤城 空城 旧城 旧人 伊人 心疼 春风 古琴 无情 迷离 奈何 断弦 焚尽 散乱 陌路 乱世 笑靥 浅笑 明眸 轻叹 烟火 一生 三生 浮生 桃花 梨花 落花 烟花 离殇 情殇 爱殇 剑殇 灼伤 仓皇 匆忙 陌上 清商 焚香 墨香 微凉 断肠 痴狂 凄凉 黄梁 未央 成双 无恙 虚妄 凝霜 洛阳 长安 江南 忘川 千年 纸伞 烟雨 回眸 公子 红尘 红颜 红衣 红豆 红线 青丝 青史 青冢 白发 白首 白骨 黄土 黄泉 碧落 紫陌情深缘浅 情深不寿 莫失莫忘 阴阳相隔 如花美眷 似水流年 眉目如画 曲终人散 繁华落尽 不诉离殇 一世长安""" temp=["xx,xx,xx了xx。","xxxx,xxxx,不过是一场xxxx。", "你说xxxx,我说xxxx,最后不过xxxx。","xx,xx,许我一场xxxx。", "一x一x一xx,半x半x半xx。","你说xxxxxxxx,后来xxxxxxxx。","xxxx,xxxx,终不敌xxxx。"] word1=words.replace(" ","").replace("\n","") word2=[r for r in words.split() if len(r)==2] word4=[r for r in words.split() if len(r)==4] def bard(): temp1=sample(temp,1)[0] while "xxxx" in temp1: temp1=temp1.replace("xxxx",sample(word4,1)[0],1) while "xx" in temp1: temp1=temp1.replace("xx",sample(word2,1)[0],1) while "x" in temp1: temp1=temp1.replace("x",sample(word1,1)[0],1) print(temp1) os.system("@title python版恶俗古风自动生成器") for r in range(99): bard() time.sleep(1)
相关文章推荐
- Python 文件/文件夹操作(读写read/write、复制copy、删除delete、重命名rename)
- Python之路【第十九篇】自定义分页实现(模块化)
- 【python学习】多线程 与 面向对象 结合的一个经典例子
- Python回顾与整理9:函数和函数式编程
- python3.4中自定义wsgi函数,make_server函数报错问题
- python xpath 语法
- Python的OO思想
- Python 正则re模块之compile()和findall()详解
- 2016.4.12Python迭代器,函数式编程,map/reduce高阶函数
- python关于BIF、标准库方法使用的注意事项总结
- python pip 安装
- nagios用python实现微信报警
- python 3.x和2.x的区别
- python list常见用法
- python.enumerate() 同时遍历索引+内容
- Python对数据库的增删改查
- 通过vscode执行python程序
- python面对对象编程----------7:callable(类调用)与context(上下文)
- PYTHON-进阶-编码处理小结
- Python的getattr()