Python的類別
範例:
假設我先設置一個計算面積的類別
class range:
範例:
假設我先設置一個計算面積的類別
class range:
之前在編寫程式時遇到一個編嗎的錯誤,錯誤訊息如下
sys:1: DeprecationWarning: Non-ASCII character '\xb0' in file C:\test.py on line 27, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
查看了說明檔才知道使用中文碼必須要事先宣告才能使用
首先示範如何開啟檔案,假設你要開啟C下面的test.txt文件可以使用open()函數
f=open('c/test.txt')
open(filename,[mode])