1. 程式人生 > >初入 python

初入 python

ren better eight lan aid one href spec oss

技術分享圖片 python之道 優雅 明確 簡單

英國發音:/?pa?θ?n/ 美國發音:/?pa?θɑ?n/), 是一種面向對象的解釋型計算機程序設計語言,由荷蘭人Guido van Rossum於1989年發明,第一個公開發行版發行於1991年 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!

1.編譯型語言與解釋型語言

技術分享圖片 技術分享圖片 交互式命令行IDE

命名規則:變量名只能是 字母、數字或下劃線的任意組合 第一個字符不能是數字

1. 變量名的長度不受限制,但其中的字符必須是字母、數字、或者下劃線(_),而不能使用空格、連字符、標點符號、引號或其他字符。

2.變量名的第一個字符不能是數字,而必須是字母或下劃線。

3.Python區分大小寫。

4.不能將Python關鍵字用作變量名。

技術分享圖片

Python有五個標準的數據類型:

  • Numbers(數字)
  • String(字符串)
  • List(列表)
  • Tuple(元組)
  • Dictionary(字典
command + / 註釋代碼 | command + D 快速復制一行代碼



技術分享圖片

初入 python