1. Python的历史
Python 的创始人为 “龟叔”,荷兰人吉多·范罗苏姆(Guido van Rossum) 1989年的圣诞节期间,吉多·范罗苏姆为了在阿姆斯特丹打发时间 决心开发一个新的脚本解释程序,作为 ABC语言的一种继承
之所以选中 Python 作为程序的名字 是因为他是 BBC 电视剧——蒙提·派森的飞行马戏团(Monty Python’s Flying Circus)的爱好者
Python 编译器于1991年诞生,它是用C语言实现的,并能够调用C语言的库文件 Python 2.0 于 2000 年 10 月 16 日发布,增加了实现完整的垃圾回收,并且支持 Unicode Python 3.0 于 2008 年 12 月 3 日发布,此版不完全兼容之前的 Python 源代码 不过,很多新特性后来也被移植到旧的 Python 2.6/2.7 版本
2. Python的应用
3. Python的特点
Python是一门动态解释性的强类型定义语言
-
动态类型语言 在运行期间才去做数据类型检查的语言 也就是说,在用动态类型的语言编程时,永远也不用给任何变量指定数据类型 该语言会在第一次赋值给变量时,在内部将数据类型记录下来 -
解释型语言 只在执行程序时,才一条一条的解释成机器语言给计算机来执行 所以运行速度是不如编译后的程序运行的快的 但如果在平台安装了解释器,就有良好的兼容性 -
强制数据类型定义语言 一旦一个变量被指定了某个数据类型 如果不经过强制转换,那么它就永远是这个数据类型了
总结来说: 优点:简单易学、开发效率高、可移植性、可扩展性、可嵌入性 缺点:速度慢、代码不能加密、多线程问题
4. Python的下载和安装
Python官网:https://www.python.org/ Python文档:https://www.python.org/doc/ 本系列以 python3.0 为例
推荐一款集成开发环境:PyCharm PyCharm 下载地址 : https://www.jetbrains.com/pycharm/download/ PyCharm 安装地址:http://www.runoob.com/w3cnote/pycharm-windows-install.html
5. 第一个Python程序
入门编程代码便是"Hello World!" - print("Hello, World!")
- # Hello, World!
复制代码
6. Python的诗 - import 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!
复制代码
这首诗反映了Python的设计哲学——Python是一种追求优雅,明确,简单的编程语言 简单来说:人生苦短,python当歌
参考:
Python 基础教程 | 菜鸟教程 中文 Python 笔记
谢谢! |