--- title: ch13. Python 文字檔案的讀取和儲存 By 彭彭 tags: 彭彭, 學習, 筆記 --- # 影片大綱 1. 檔案操作流程 1.1 開啟檔案、操作檔案、關閉檔案 1.2 開啟模式、檔案編碼 UTF-8 1.3 最佳實務:使用 with ... as ... 語法 1.4 檔案物件 2. 讀取檔案 2.1 一次讀取全部:read() 2.2 逐行讀取資料:使用 for 迴圈 3. 寫入檔案 3.1 寫入字串到檔案中:write(字串) 3.2 寫入換行符號:\n 4. 讀取、儲存 JSON 格式的資料 4.1 載入內建的 json 模組 4.2 讀取資料:json.load(檔案物件) 4.3 寫入資料:json.dump(資料, 檔案物件) # 影片 {%youtube C4OkV6DrVRs %} # 筆記 --- # END
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up