1.打开mac 或 linux 终端:
查看 python 是否 已经支持
MacBook-Pro:~ xue$ python --version
Python 3.5.1 :: Anaconda 4.0.0 (x86_64)
2.然后 输入 python 进入python cli 交互环境
MacBook-Pro:~ xue$ python
Python 3.5.1 |Anaconda 4.0.0 (x86_64)| (default, Dec 7 2015, 11:24:55)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
3.输入import this
>>> import this
返回结果如下
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 rule

本文介绍了在Python中输入`import this`会揭示的一系列编程哲学,包括“漂亮优于丑陋”、“简单优于复杂”、“可读性重要”以及“命名空间是一个好主意”。这些原则指导了Python的代码编写和设计,强调了代码的美观、明确和可维护性。
最低0.47元/天 解锁文章
1947

被折叠的 条评论
为什么被折叠?



