Python
介紹
- 容易寫
- 功能想當多
- 跨平台
- 容易擴充
也是因為以上特點,所以可以在各個平台上看到(Windows, Linux, Mac),也可以看到在許多領域上使用,網路、商業軟體、嵌入是系統,這也說明他有龐大的模組支援。
而在看直譯器本身會發現會有CPython,、PyPy、Jython等,但是只要在使用上大多還是使用CPython,而CPython就是使用C語言寫成的Python直譯器,想必只以知道PyPy就是用Python寫的,Jython就是用Java寫的,當然詳細要知道如何寫成的,需要去了解編譯器,而這個東西的理解,也需要演算法跟資料結構的學習。
版本
目前學習過程中,建議使用3.7版本,除非使用的模組只有在Python2中能夠使用。
Python的官方網站
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 1.0 - 1994
- Python 1.2 - 1995
- Python 1.3 - 1995
- Python 1.4 - 1996
- Python 1.5 - 1997
- Python 1.6 - 2000
- Python 2.0 - 2000
- Python 2.1 - 2001
- Python 2.2 - 2001
- Python 2.3 - 2003
- Python 2.4 - 2004
- Python 2.5 - 2006
- Python 2.6 - 2008
- Python 2.7 - 2010
- Python 3.0 - 2008
- Python 3.1 - 2009
- Python 3.2 - 2011
- Python 3.3 - 2012
- Python 3.4 - 2014
- Python 3.5 - 2015
- Python 3.6 - 2016
- Python3.7 - 2018
Python的Zen
在終端機下進入到Python之後,輸入 import this ,你可以看到Python的Zen,也就是中心思想。
圖片上的內容如下:
Python 2.7.15 (default, Jun 7 2018, 19:31:23)
Python 2.7.15 (default, Jun 7 2018, 19:31:23)
[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.>>>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 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!
第一個程式Hello World
所有的程式語言的第一個程式,Python相當簡單,print是印出,而單引號中間是字串,也就是用print這個函數,把“Hello World”這串字串傳入,這樣就可以在螢幕上顯示Hello World了,這個範例代表輸出的概念。
print('Hello World')
第二個程式Hello, you
注意在這個範例目的是要將鍵盤輸入存入變數中,使用了input函數,函數代入的字串會顯示在螢幕當中,讓使用者看到,讓使用者輸入自己的名字,注意這只有在Python3能夠執行,因為在Python2-input函數要在Name前後增加單引號才能夠輸入,這個例子代表輸入到輸出。
var = input('What is your Name?')
print('Hello, ' + var)
開發環境
個人開發環境習慣是終端機,編輯器用Sublime,這部分只是因為習慣而已,還可以看建議的開發環境給大家參考開發環境要如何建置。
PyPI
www.python.org
PEP
PyPI
www.python.org
PEP
投影片-slideshare:Python_介紹
影片-youtube:Python_介紹
留言
張貼留言