內容簡介
本書圍繞教師職達慨巴紋業道德與教育法律法規兩個主題展開,分別闡述了道德與教師職業道德、教師職業道德原則和範疇、教師職業道德規範、教師職業道德修養、教育法概述、依法治教、依法執教與未成年人保護等內容。 本書的特點首先是“新”,結合我國教育發展新要求,解讀新時代教師職業道德規範,解讀**教育法律法規與教育政策;其次是“實”,注重理論與實踐相結合,關注教育教學活動中的實際問題,針對現霉幾朵實需求拓展相關櫃嚷龍資源,頸故迎力求實用。 本書可作為高校師範類本專科教師職業道德與教育法律法規課程教材,也可作為教師繼續教育的培訓教材。
圖書目錄
第1章 初識Python·································1
1.1 Python簡史····································1
1.2 Python的優缺點·····························1
1.3 Python的版本·································2
1.4 Python的套用領域··························2
1.5 Python環境的安裝和運行················3
1.5.1 Python的下載與安裝···················3
1.5.2 IDLE環境的使用·······················5
1.6 其他工具介紹································9
第2章 Python基礎知識·························12
案例1 便捷水果店
2.1 數值類型·····································13
2.1.1 整型····································13
2.1.2 浮點型·································13
2.1.3 複數類型······························14
2.1.4 布爾類型······························15
2.1.5 類型轉換······························15
2.2 常量和變數··································16
2.2.1 變數的命名規則······················16
2.2.2 變數的引用····························18
2.3 數值運算·····································19
2.3.1 算術運算符····························19
2.3.2 賦值運算符····························20
2.3.3 關係運算符····························22
2.3.4 邏輯運算符····························22
2.3.5 運算符的優先權······················24
2.4 字元串········································24
2.4.1 字元串的定義·························25
2.4.2 字元串的基本操作···················25
2.5 格式化輸入和輸出························27
2.5.1 輸入函式input()·······················28
2.5.2 eval()函式·····························29
2.5.3 多個變數的輸入······················30
2.5.4 輸出函堡捉微數print()·······················31
2.5.5 字元串格式化format()方法··········32
2.5.6 字元串格式化占位符%··············35
2.6 Tkinter圖剃整贈頌形界面開發····················36
2.6.1 第一個Tkinter程式:創建視窗嘗喇·····37
2.6.2 標籤(Label)····························38
2.6.3 文本框(Entry)·························40
2.6.4 列表框(Listbox)·······················42
2.6.5 按鈕(Button)··························44
2.6.6 多行文本框(Text)·····················47
2.6.7 單選按鈕(Radiobutton)··············48
2.6.8 複選框(Checkbutton)·················49
2.6.9 畫布(Canvas)··························52
2.6.10 選單···································52
2.6.11 對話框································55
2.6.12 Tkinter幾何布局管理器············57
第3章 控制結構····································63
案例2 健康小助手BMI
3.1 控制結構概述······························64
3.2 順序結構·····································64
3.3 分支結構·····································65
3.3.1 單分支選擇結構······················66
3.3.2 雙分支選擇結構······················67
3.3.3 多分支選擇結構······················69
3.3.4 if語句的嵌套··························72
3.4 循環結構·····································75
3.4.1 while循環······························75
3.4.2 for循環·································79
3.5 跳轉語句·····································82
3.6 異常處理·····································84
3.7 循環嵌套·····································87
3.8 設計實現BMI健康小助手··············90
第4章 字元串及其方法··························94
案例3 居民身份證
4.1 字元串········································94
4.1.1 字元串的定義·························95
4.1.2 轉義字元······························95
4.1.3 不換行輸出····························96
4.2 字元串的索引與切片····················97
4.2.1 字元串的索引·························97
4.2.2 字元串的切片·························97
4.3 字元串的方法······························99
4.3.1 方法····································99
4.3.2 字元串替換replace()·················99
4.3.3 字元串分割split()····················100
4.3.4 去除字元串兩側字元strip()········100
4.3.5 用指定的字元連線生成新字元串
join()··································100
4.3.6 查找子字元串find()·················100
4.4 字元串的格式化輸出···················105
4.4.1 占位符%······························105
4.4.2 format()方法··························106
4.4.3 f-strings·······························106
第5章 函式··········································111
案例4 通訊錄
5.1 為什麼需要函式··························111
5.2 函式的定義·································113
5.2.1 無參函式的定義與調用············114
5.2.2 有參函式的定義與調用············115
5.3 函式的參數傳遞··························117
5.3.1 位置參數·····························117
5.3.2 關鍵字參數···························118
5.3.3 默認參數·····························118
5.3.4 不定長參數···························119
5.4 函式的返回值·····························120
5.5 函式的特殊形式··························121
5.5.1 匿名函式·····························121
5.5.2 遞歸函式·····························121
5.6 變數的作用域·····························123
5.6.1 局部變數·····························123
5.6.2 全局變數·····························123
5.7 檔案的操作·································125
5.7.1 檔案的路徑···························125
5.7.2 檔案的分類···························125
5.7.3 檔案的寫入···························126
5.7.4 檔案的讀取···························129
5.7.5 檔案的定位讀取·····················131
5.7.6 檔案的重命名和刪除···············132
5.7.7 目錄操作·····························132
5.7.8 檔案路徑操作························134
第6章 組合數據類型···························139
案例5 詞頻統計
6.1 檔案的操作·································141
6.1.1 檔案對象的常用方法···············141
6.1.2 上下文管理語句with················143
6.2 正則表達式re模組·······················146
6.2.1 正則表達式基礎知識···············146
6.2.2 re模組·································149
6.3 列表···········································153
6.3.1 列表的創建···························153
6.3.2 列表元素的訪問·····················154
6.3.3 列表的遍歷···························154
6.3.4 列表的排序···························155
6.3.5 列表的基本操作·····················156
6.3.6 嵌套列表·····························159
6.3.7 綜合案例:隨機撲克牌············159
6.4 元組···········································162
6.4.1 元組的創建···························162
6.4.2 元組元素的訪問·····················163
6.4.3 元組的修改···························163
6.4.4 元組的刪除···························164
6.5 集合···········································166
6.5.1 集合的創建···························166
6.5.2 集合元素的添加·····················167
6.5.3 集合元素的刪除·····················167
6.5.4 集合類型的操作符··················168
6.5.5 過濾函式filter()······················171
6.6 字典···········································173
6.6.1 字典的創建···························174
6.6.2 字典元素的訪問·····················174
6.6.3 字典的基本操作·····················175
6.6.4 字典的高級套用·····················179
6.7 第三方模組的安裝和使用·············181
6.7.1 模組···································182
6.7.2 第三方模組的下載與安裝·········186
6.7.3 jieba庫································188
6.7.4 wordcloud庫··························191
6.7.5 matplotlib庫··························193
6.8 組合數據類型的高級特性·············197
6.8.1 疊代···································197
6.8.2 推導式································199
6.8.3 zip()、map()和filter()···············200
第7章 面向對象程式設計·····················206
案例6 電子寵物
7.1 面向對象概述·····························207
7.2 面向對象的基本概念···················207
7.3 類與對象····································209
7.3.1 類與對象的關係·····················209
7.3.2 創建和使用類························210
7.4 類的屬性訪問·····························216
7.5 封裝機制及實現方法···················218
7.5.1 封裝的機制···························218
7.5.2 封裝的實現···························219
7.6 類屬性和實例屬性·······················221
7.7 類方法、靜態方法和實例方法······224
7.8 繼承···········································226
7.8.1 單繼承································227
7.8.2 多繼承································228
7.8.3 方法的重寫···························230
7.8.4 調用父類的方法·····················231
7.9 多態···········································233
第8章 turtle庫及其套用·····················238
案例7 神奇的抽象畫
8.1 turtle庫·······································239
8.2 turtle庫的基本用法······················239
8.2.1 移動函式·····························240
8.2.2 顏色控制函式························244
8.2.3 turtle的空間坐標·····················246
8.2.4 畫筆狀態函式························247
8.3 隨機函式····································249
8.4 turtle的高階用法··························251
8.4.1 顏色填充·····························251
8.4.2 生成隨機顏色························253
8.4.3 常用繪製函式························254
8.4.4 獲取“海龜”的狀態···············256
第9章 pygame庫及其套用·················260
案例8 大球吃小球遊戲
9.1 pygame基礎知識·························261
9.1.1 安裝pygame庫·······················261
9.1.2 pygame的初始化和退出············261
9.1.3 創建遊戲視窗························262
9.1.4 遊戲循環·····························264
9.1.5 事件與事件處理·····················264
9.1.6 繪製圖形圖像························266
9.1.7 pygame的窗體坐標體系············267
9.1.8 pygame的字型·······················269
9.2 模組化編程·································273
9.2.1 遊戲的模組劃分·····················273
9.2.2 遊戲的實現···························274
第10章 數據分析與可視化···················282
案例9 中國城市數據
10.1 Jupyter Notebook························284
10.1.1 Anaconda的安裝··················284
10.1.2 Jupyter Notebook的常用功能···287
10.2 初識pandas庫····························293
10.2.1 一維數組Series···················294
10.2.2 二維數組DataFrame··············294
10.3 運用pandas庫完成檔案的操作·····295
10.3.1 CSV檔案的讀寫··················295
10.3.2 選取部分行和列··················297
10.3.3 刪除部分行和列··················302
10.4 運用pandas庫完成數據分析········304
10.4.1 索引和排序·······················304
10.4.2 分組································305
10.4.3 分割與合併·······················307
10.4.4 數據透視表·······················308
10.5 運用pandas庫完成數據清洗········311
10.5.1 缺失值處理·······················312
10.5.2 重複值去重·······················316
10.6 運用matplotlib庫完成數據
可視化······································320
10.6.1 導入pyplot模組···················322
10.6.2 切分繪圖區域·····················322
10.6.3 pyplot.plot()繪圖函式············323
10.6.4 柱狀圖·····························331
10.6.5 折線圖·····························334
10.6.6 餅圖································335
10.6.7 散點圖·····························336
第11章 Python網路爬蟲····················344
案例10 豆瓣網電影信息的爬取
11.1 網路爬蟲的概念························345
11.2 網路爬蟲的工作流程··················346
11.3 通過requests庫獲取網頁數據·······348
11.3.1 requests庫簡介····················349
11.3.2 requests庫的常用方法···········349
11.4 通過urllib庫獲取網頁數據··········354
11.4.1 urllib庫簡介·······················354
11.4.2 urllib庫的基本使用···············354
11.5 通過BeautifulSoup解析網頁········361
11.5.1 beautifulsoup4庫簡介············361
11.5.2 beautifulsoup4庫的使用·········362
11.6 通過XPath解析網頁···················370
11.6.1 XPath基本語法···················370
11.6.2 XPath謂語表達式················372
11.6.3 XPath常用的功能函式···········373
11.6.4 XPath的使用······················373
11.7 數據存儲··································377
11.7.1 保存於CSV檔案··················377
11.7.2 保存於JSON檔案·················382
參考文獻··············································387