禅之道——http://www.pythontip.com/coding/run(python online)
2015-05-31 19:19
573 查看
在线python编程
code:
import this
s=this.s
d = {}
for c in (65, 97):
for i in range(26):
d[chr(i+c)] = chr((i+13) % 26 + c)
print 'python 之禅'
print "".join([d.get(c, c) for c in s])
output:
python 之禅
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!
code:
import this
s=this.s
d = {}
for c in (65, 97):
for i in range(26):
d[chr(i+c)] = chr((i+13) % 26 + c)
print 'python 之禅'
print "".join([d.get(c, c) for c in s])
output:
python 之禅
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!
相关文章推荐
- 解读uglifyJS(转载:http://rapheal.sinaapp.com/2014/05/15/uglifyjs-ast-parse/)
- D-link 带USB口无线路由器 配置网络共享打印机
- VMware中网络设置之NAT
- android HTTPURLConnection解决不能访问HTTPs请求
- 网络数据请求实践二:多文件上传的实现方法
- No module named http_client
- 网络数据请求实践一:android-async-http实现下载和上传
- 独立成分分析http://blog.sina.com.cn/s/blog_73402e3c0101gqy0.html
- 学习笔记一:TCP与UDP通信协议
- TCP/IP 笔记 1.3 IP:网际协议
- 因子分析(Factor Analysis) http://www.cnblogs.com/jerrylead/archive/2011/05/11/2043317.html
- 混合高斯模型 http://www.cnblogs.com/CBDoctor/archive/2011/11/06/2236286.html
- TCP/IP 笔记 1.2 链 路 层
- HTTP协议基础
- JavaWeb:报错信息The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
- Android网络框架Volley(体验篇)
- ListView异步加载网络图片完美版之双缓存技术
- Android网络框架Volley(实战篇)
- Python网络编程
- could not connect to Appwrapper.Please make sue that TCP port 12015 is not blocked