79/80 Intro to I/O with files in python

1 files: .txt(文字檔) / .csv (逗點分格資料的檔案 EXCEL) / .html(網頁)

常用 .txt 理由如下

2 I/O (input / output)

81 Encoding 編碼

1 將我們用的語言與符號轉換成電腦語言的過程

2 如果開啟資料發現亂碼,可以先確認是否是encoding問題

3 file = open(’myfile.txt’, mode=’r’, encoding=’cp1252’) #keyword argument

file = open(’myfile.txt’, ’r’, ’cp1252’) #positional argument

 cp950      繁體中文

cp936 簡體中文

cp1252 拉丁語系(英、法、德、西.....)

utf-8 (standard of HTML)

ASCII