讀取與寫入
#不能讀取中文字編碼,顯示亂碼
file = open("5566.txt", mode="r")
file.write("\n很棒吧!")
file.close()
#第三個參數:顯示中文編碼
file = open("5566.txt", mode="a", encoding="utf-8")
file.write("\n很棒吧!")
file.close()
#自動執行CLOSE關閉檔案
with open ("5566.txt", mode="a", encoding="utf-8") as file:
file.write("\n超級厲害的啦~~~~")