Python 速查手冊
目錄
關於 Python 語言,這本手冊提供了一個快速認識各項基本要件的導覽,從程式語言 (programming) 的基本概念、標記 (token) 、資料型態 (data type) 、運算子 (operator) 與運算式 (expression) 、控制結構 (control flow) 等等,依 Python 的特性一路講到進階主題,包括類別 (class) 設計與物件導向 (object-oriented) 觀念,以及許多可直接套用的常用功能,如內建函數、內建型態等,每個部份均提供簡單示範,有超過 280 個範例程式。
除了基本語法與廣大的內建項目之外,最後的單元 12 挑選部分 Python 標準程式庫的常用功能做介紹,例如⋯⋯
內容範例以直接利用 Python 直譯器 (interpreter) 於命令列執行為主,部分利用 Python 的互動式介面呈現,執行結果在各平台如 MS-Windows 、 Mac OS 或 Linux 除了平台專屬功能外都一致。
- 單元 1 - 基本概念
- 單元 2 - 基本內建型態
- 單元 3 - 運算子與運算式
- 3.1 算術運算
- 3.2 位元運算
- 3.3 比較運算
- 3.4 指派運算
- 3.5 邏輯運算
- 3.6 del 運算
- 3.7 is 運算
- 3.8 in 運算
- 3.9 lambda 運算
- 3.10 yield 運算
- 3.11 串列的綜合運算
- 單元 4 - 陳述
- 4.1 簡單陳述 assert
- 4.2 簡單陳述 pass
- 4.3 簡單陳述 return
- 4.4 簡單陳述 raise
- 4.5 簡單陳述 break
- 4.6 簡單陳述 continue
- 4.7 簡單陳述 import from as
- 4.8 簡單陳述 global
- 4.9 簡單陳述 nonlocal
- 4.10 複合陳述 if elif else
- 4.11 複合陳述 for in else
- 4.12 複合陳述 while else
- 4.13 複合陳述 try except finally else
- 4.14 複合陳述 with as
- 單元 5 - 函數
- 單元 6 - 類別
- 6.1 __init__()
- 6.2 __str__()
- 6.3 __doc__
- 6.4 類別屬性與實體屬性
- 6.5 static 方法與類別方法
- 6.6 封裝
- 6.7 繼承
- 6.8 子類別的方法改寫
- 6.9 多重繼承
- 6.10 多型
- 6.11 __del__()
- 6.12 迭代器
- 6.13 物件模型
- 單元 7 - 模組與 __name__
- 單元 8 - 套件與組織程式庫
- 單元 9 - 內建函數
- 9.1 型態相關
- bool()
- bytearray()
- bytes()
- complex()
- dict()
- float()
- frozenset()
- int()
- list()
- memoryview()
- object()
- range()
- set()
- slice()
- tuple()
- type()
- 9.2 串列排序
- sorted()
- 9.3 字串相關
- 9.4 迭代器相關
- 9.5 裝飾子相關
- 9.6 執行相關
- 9.7 作用域相關
- 9.8 屬性相關
- 9.9 數字處理
- 9.10 檔案處理
- open()
- 9.11 基本輸入輸出
- 9.12 內建說明
- help()
- 9.13 物件相關
- 單元 10 - 內建型態
- 10.1 串列 list
- list.append()
- list.clear()
- list.copy()
- list.count()
- list.extend()
- list.index()
- list.insert()
- list.pop()
- list.remove()
- list.reverse()
- list.sort()
- 10.2 序對 tuple
- 10.3 range
- 10.4 字串 str
- str.capitalize()
- str.casefold()
- str.center()
- str.count()
- str.endswith()
- str.expandtabs()
- str.find()
- str.format()
- str.format_map()
- str.index()
- str.isalnum()
- str.isalpha()
- str.isdecimal()
- str.isdigit()
- str.isidentifier()
- str.islower()
- str.isnumeric()
- str.isprintable()
- str.isspace()
- str.istitle()
- str.isupper()
- str.join()
- str.ljust()
- str.lower()
- str.lstrip()
- str.maketrans()
- str.partition()
- str.replace()
- str.rfind()
- str.rindex()
- str.rjust()
- str.rpartition()
- str.rsplit()
- str.rstrip()
- str.split()
- str.splitlines()
- str.startswith()
- str.strip()
- str.swapcase()
- str.title()
- str.ranslate()
- str.upper()
- str.zfill()
- 10.5 集合 set
- set.add()
- set.clear()
- set.copy()
- set.difference()
- set.difference_update()
- set.discard()
- set.intersection()
- set.intersection_update()
- set.isdisjoint()
- set.issubset()
- set.issuperset()
- set.pop()
- set.remove()
- set.symmetric_difference()
- set.symmetric_difference_update()
- set.union()
- set.update()
- 10.6 frozenset
- frozenset.copy()
- frozenset.difference()
- frozenset.intersection()
- frozenset.isdisjoint()
- frozenset.issubset()
- frozenset.issuperset()
- frozenset.symmetric_difference()
- frozenset.union()
- 10.7 字典 dict
- dict.clear()
- dict.copy()
- dict.fromkeys()
- dict.get()
- dict.items()
- dict.keys()
- dict.pop()
- dict.popitem()
- dict.setdefault()
- dict.update()
- dict.values()
- 10.8 其他內建型態
- 單元 11 - 內建例外
- 單元 12 - 標準程式庫導覽
本書所有範例程式 - 下載連結。
相關教學影片