在 python的lib目录里有一个: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])
输出结果为:(翻译自IT柏拉图)
代码如下:The Zen of Python, by Tim Peters
《Python 的禅》 by 提姆·彼特
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!
命名空间是一个让人尖呼的伟大构想 —— 我们应该在那方面做得更多!
新闻热点
疑难解答