作者是一位從事軟件開發(fā)三年的普通程序員,一直以來所使用的計算機邏輯語言是RPGLE,腳本語言CLLE,數(shù)據庫DB2。小眾語言就業(yè)面窄,面對最近越來越火的Python也希望自己能跟上時代的步伐。
-- 之后的文章更新都是圍繞著Python從0開始學習到....一直堅持下去
-- 本專題學習閱讀的材料有《廖雪峰官網Python教程》《笨辦法學Python3》
-- 歡迎在評論區(qū)討論留言
1. Python3安裝
Python3的安裝還是比較簡便的,打開官網https://www.python.org/,直接點擊下方Download Python3.7.3,下載好以后 打開安裝包直接安裝即可,mac環(huán)境下會自動配置環(huán)境變量。

download.png
2. Python3的第一次嘗試
安裝完成之后Python3的環(huán)境就算搭建好了。接下來在Terminal中,做一些簡單嘗試。
FANGQIdeMacBook-Pro:~ fangqi$ python3
Python 3.7.2 (v3.7.2:9a3ffc0492, Dec 24 2018, 02:44:43)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> print("Hello World!")
Hello World!
>>> print(1)
1
>>> print(True)
True
第一個程序當然是Hello world。在python3中直接使用print()輸出就好。
3. 如何使用編輯器進行多行Python代碼的編寫
編輯器根據個人喜好選取一款適合自己的就好。

第一個多行python代碼.png
運行結果如下:
FANGQIdeMacBook-Pro:PythonStudy fangqi$ python3 ex1.py
Hello World!
Hello Again!
I like typing this.
This is fun.
Yay! Printing.
I'd much rather you 'not'.
I "said" do not touch this.
在python中行首有#代表注釋行。
如果需要多行注釋在每行前加#
4. python中的數(shù)字和計算
Python中的基本數(shù)據類型有:
- 整數(shù)
- 浮點數(shù)
- 布爾值
- 字符串
- 空值
None(不能理解為0) - 變量
- 常量

數(shù)據和簡單的數(shù)學計算.png
FANGQIdeMacBook-Pro:PythonStudy fangqi$ python3 ex2.py
I will not count my chickens:
Hens 30.0
Roosters 97
Noew I will count the eggs:
6.75
Is it true 3+2<5-7?
False
What is 3+2? 5
What is 5-7? -2
Oh, that's why it's False.
How about some more.
Is it greater> True
Is it greater or equal? True
Is it less or equal? False