“导入这个”和“垃圾人”激发的幽默感_

theword的Python项目详细描述


Build Status

灵感来自python的import thisThe TrashmenThe Family Guytheword 是一个古怪的图书馆来回答那个永恒的问题,“这个词是什么?”?“。”

安装

从任何命令行:

$ pip install theword

模拟python的禅

从任何命令行:

$ python -c "import theword"

_Surfin' Bird_, by The Trashmen

A well a everybody's heard about the bird
Bird, bird, bird, b-bird's the word
A well a bird, bird, bird, b-bird's the word
A well a bird, bird, bird, b-bird's the word
A well a bird, bird, b-bird's the word

一般用法

您可以导入以下任意项:

fromthewordimportTheWord,TheBird,what_is_the_word

提出问题:

>>>what_is_the_word()<theword.theword.TheBirdobjectat0x10f582d90># Returns TheBird>>>what_is_the_word().answer'[E]verybody knows that the bird is the word!'>>>printwhat_is_the_word()# We overloaded __str__{"answer":"[E]verybody knows that the bird is the word!","question":"What's the word?","id":"The Bird"}

更有趣的是:

>>>what_is_the_word().play()# Turn on the volume, ensure your WiFi is on{'artist':'The Trashmen','title':"Surfin' Bird",'question':"What's the word?",'released':1964,'answer':'[E]verybody knows that the bird is the word!','id':'The Bird'}>>>what_is_the_word().celebrate()# Be prepared to laugh{'answer':'[E]verybody knows that the bird is the word!','celebrated_on':"FOX's The Family Guy",'question':"What's the word?",'id':'The Bird','celebrated_by':'Seth MacFarlane'}>>>

如果你看了所有的小品,你会认出这个:

Sir, our math shows that the Bird is greater than or equal to the Word!
>>>isinstance(TheBird(),TheWord)True>>>issubclass(TheBird,TheWord)True

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何强制用户在允许访问活动之前处理对话框?我的许可证代码怎么了?   java ArraysList作为JSON   mysql如何在java中创建包含多个可选where子句的搜索语句?   java如何让Apache Camel在“直接”路径的末尾删除文件?   使用socket在两个Androids之间进行java实时数据传输。IO(websocket)和4G   如何在java中实现两个CORBA服务器之间的通信   会话树xml表示为java对象   java Skype4Java编号swtwin323325   java RecyclerView getAdapterPosition()不工作:第一次单击返回正确位置,第二次单击返回1   java在$TOMCAT/conf/context上为JNDI设置资源。xml   java为什么第二个矩形冲突在第一个矩形冲突时不起作用?   JScrollPane上的java JTextArea未出现在JPanel上   java如何将实现的PriorityQueue打印为字符串?   jpa使用Jersey更新用户角色RESTJava(JAXRS)