funny_python 00 The Zen of Python
# 打算每天多动的时候尽量搜索一些和coding相关的funny stuff
Day 00 - PEP 20 The Zen of Python
在shell里面输入python -m this 回车,可以欣赏到Tim Peters 的The Zen of Python
除此之外,还可以通过import this 来获取这段文字
好奇的瓦还试了import that等其他看起来类似的但明显没可能再有好玩儿的事情发生的关键字,果然没有内容。
机智的我找到了this.py的源码(算是一个复活节彩蛋了),代码如下:
s = """Gur Mra bs Clguba, ol Gvz Crgref Ornhgvshy vf orggre guna htyl.
Rkcyvpvg vf orggre guna vzcyvpvg.
Fvzcyr vf orggre guna pbzcyrk.
Pbzcyrk vf orggre guna pbzcyvpngrq.
Syng vf orggre guna arfgrq.
Fcnefr vf orggre guna qrafr.
Ernqnovyvgl pbhagf.
Fcrpvny pnfrf nera'g fcrpvny rabhtu gb oernx gur ehyrf.
Nygubhtu cenpgvpnyvgl orngf chevgl.
Reebef fubhyq arire cnff fvyragyl.
Hayrff rkcyvpvgyl fvyraprq.
Va gur snpr bs nzovthvgl, ershfr gur grzcgngvba gb thrff.
Gurer fubhyq or bar-- naq cersrenoyl bayl bar --boivbhf jnl gb qb vg.
Nygubhtu gung jnl znl abg or boivbhf ng svefg hayrff lbh'er Qhgpu.
Abj vf orggre guna arire.
Nygubhtu arire vf bsgra orggre guna *evtug* abj.
Vs gur vzcyrzragngvba vf uneq gb rkcynva, vg'f n onq vqrn.
Vs gur vzcyrzragngvba vf rnfl gb rkcynva, vg znl or n tbbq vqrn.
Anzrfcnprf ner bar ubaxvat terng vqrn -- yrg'f qb zber bs gubfr!""" d = {}
for c in (65, 97):
for i in range(26):
d[chr(i+c)] = chr((i+13) % 26 + c) print("".join([d.get(c, c) for c in s]))
实际输出结果:
C:\Users\Naomi>python -m this
The Zen of Python, by Tim Peters Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those! C:\Users\Naomi>
搜索的时候还发现了一个python humor列表,还没有深入研究,不过看起来应该很有意思的样子。想什么呢,python (Monty Python's Flying Circus) 原本就是非常有意思的啊!
那就请继续探索python humor吧!Animo~!
References:
PEP 20 -- The Zen of Python 官方文档
https://www.python.org/dev/peps/pep-0020/
维基百科The Zen of Python
https://en.wikipedia.org/wiki/Zen_of_Python
funny_python 00 The Zen of Python的更多相关文章
- Zen of Python
Zen of Python $ python Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit ...
- python之禅 the zen of python
>>> import this The Zen of Python, by Tim Peters Beautiful is better than ugly. Explicit is ...
- Python import this : The Zen of Python
>>> import thisThe Zen of Python, by Tim Peters Beautiful is better than ugly.Explicit is b ...
- Python彩蛋--zen of python
今天早上在公交上浏览博客的时候,发现了python里面的一个小彩蛋--zen of python 一首python之歌 我们来看一看... 是不是很简单,在python shell 里 输入 im ...
- Zen of Python(Python的19条哲学)
The Zen of Python Beautiful is better than ugly. Explicit is better than implicit. Simple is better ...
- 趣闻|Python之禅(The Zen of Python)
在Python解释器中输入“import this”会发生什么?如果你不知道这个彩蛋,推荐继续阅读这篇文章. 2001年秋,Foretec(一家会议组织公司)正在准备召开第十届Internationa ...
- Python的设计哲学--zen of Python
Python的设计哲学--zen of Python Beautiful is better than ugly. 优美胜于丑陋 Explicit is better than ...
- Import This - The Zen of Python
The Zen of Python -- by Tim Peters Beautiful is better than ugly.Explicit is better than implicit.Si ...
- Go for Pythonistas Go and the Zen of Python 禅
Go for Pythonistas https://talks.golang.org/2013/go4python.slide#1 Things I don't like about Python ...
随机推荐
- 魅蓝note2在ubuntu14.04下mtp模式无法自动mount的解决方法
是因为新机型没在列表里的原因. 处理方法如下: As far as I know, MTP works fine in Trusty. You can try this: Uncomment #use ...
- SimpleThreadPool实践
前言 并发(Concurrency)一直谈论java绕不开的一个话题,从移动开发工程师到后端工程师,几乎所有的面试都要涉及到并发/多线程的一些问题.虽然多数时候我们使用线程池,都是已经实现好的框架—— ...
- [转载]http协议 文件下载原理及多线程断点续传
最近研究了一下关于文件下载的相关内容,觉得还是写些东西记下来比较好.起初只是想研究研究,但后来发现写个可重用性比较高的模块还是很有必要的,我想这也是大多数开发人员的习惯吧.对于HTTP协议,向服务器请 ...
- 规则引擎集成接口(四)SQL执行语句
SQL执行语句 右键点击数据库连接文件“hr”—“添加SQL执行语句”,如下图: 弹出窗体,如下图: 将显示名称改为“部门名称”,返回至类型设置为“string”,在编写sql语句,如下图: 点击确定 ...
- Javascript猜数字游戏
<!DOCTYPE html> <html> <head> <title></title> <meta charset="u ...
- shell 中调用其他的脚本
方法有三种: 1 使用source 2 使用 . 3 使用sh 简单实验: first.sh #!/bin/bashecho 'your are in first file' second.sh #! ...
- ORM艰辛路之EF
经过一段时间对EF的研究,发现EF还是有很大的作用的,起码比自己写代码快捷许多.不过往往一个学习一个新东西开始都是简单的,后面才慢慢了解到它的许多不方便 优点: EF在对一个实体的增删改以及继承方面做 ...
- PHP左、右、内连接
left join :左连接,返回左表中所有的记录以及右表中连接字段相等的记录.right join :右连接,返回右表中所有的记录以及左表中连接字段相等的记录.inner join: 内连接,又 ...
- js面向对象的实现(example 二)
//这个方法和上篇文章(js面向对象的实现(example 一))中的方法类似,但是更为简洁 //通过函数赋值的方式来构造对象 //同样通过闭包的方式来封装对象及内部变量 (function () { ...
- arcgis_engine_c++_runtime_r6034_error
在启动项目中添加app.manifest文件 <?xml version="1.0" encoding="utf-8"?> <asmv1:as ...