我已经定义了一个类来处理文件,但在尝试实例化类并传递文件名时出现以下错误。 让我知道会是什么问题?Python上的基本类
>>> class fileprocess:
... def pread(self,filename):
... print filename
... f = open(filename,'w')
... print f
>>> x = fileprocess
>>> x.pread('c:/test.txt')
Traceback (most recent call last):
File "", line 1, in
TypeError: unbound method pread() must be called with
fileprocess instance as first argument (got nothing instead)