home1.gif


一. Python 简介


Python 是由荷兰人“龟叔”吉多发明的一种编程语言。

Python是解释性语言。(编译型语言需要编译成可执行代码后才可执行,Python可用解释器解释运行)

1. Python 的历史


  1. 1989年,龟叔(在圣诞节)开始编写 Python 语言的编译器;
  2. 1991年,第一个 Python 解释器诞生(C语言实现的);
  3. 1994年,Python 1.0 正式发布;
  4. 2000年,Python 2.0 正式发布;
  5. 2008年,Python 3.0 正式发布;

版本号说明:

  • Python 的版本号分为三段,形如 A.B.C(大部分软件的版本号也类似)。
  • 其中 A 表示大版本号,当软件整体重写升级或出现不向后兼容的改变时,才会增加 A;B 表示功能更新,出现新功能时增加 B;C 表示小的改动(如修复bug),又要有修改就增加 C。

2. Python 的优缺点

简单来说,Python是一个“优雅、明确、简单”的编程语言


Python 的优点比较显著的有:

  1. 简单、明确、易学;
  2. 源码开放,拥有强大的社区和生态圈;
  3. 作为解释性语言,具有平台可移植性,能在不同的OS(Windows、macOS、Linux等)上运行;
  4. 代码规范程度高,可读性强;

Python 的缺点:

  1. 执行效率稍低;
  2. 代码无法加密;(当然,越来越多的公司倾向销售服务,此点将会不断弱化)

3. Python 的应用领域


Python 的应用比较广泛,诸如:

  • Web 服务器应用开发 *
  • 云基础设施开发
  • 网络数据采集(爬虫)*
  • 数据分析 *
  • 量化交易
  • 机器学习 *
  • 自动化测试 *
  • 自动化运维 *

4. Python 哲学


  1. >>> import this
  2. The Zen of Python, by Tim Peters
  3. Beautiful is better than ugly.
  4. Explicit is better than implicit.
  5. Simple is better than complex.
  6. Complex is better than complicated.
  7. Flat is better than nested.
  8. Sparse is better than dense.
  9. Readability counts.
  10. Special cases aren't special enough to break the rules.
  11. Although practicality beats purity.
  12. Errors should never pass silently.
  13. Unless explicitly silenced.
  14. In the face of ambiguity, refuse the temptation to guess.
  15. There should be one-- and preferably only one --obvious way to do it.
  16. Although that way may not be obvious at first unless you're Dutch.
  17. Now is better than never.
  18. Although never is often better than *right* now.
  19. If the implementation is hard to explain, it's a bad idea.
  20. If the implementation is easy to explain, it may be a good idea.
  21. Namespaces are one honking great idea -- let's do more of those!

end1.gif