AttributeError:stat实例没有属性X?

pyt*_*nic 0 python class object

运行以下代码时,我得到了AttributeError: stat instance has no attribute 'printStats'.这里有什么问题?

class stat():
    def __init__(self, fname, blocks, backEdges):
        self.fname = fname
        self.blocks = blocks
        self.backEdges = backEdges

    def printStats(self):
        print self.fname + str(self.blocks) + str(self.backEdges)

element = stat("a", 1, 2)
element.printStats()
Run Code Online (Sandbox Code Playgroud)

Ign*_*ams 5

你的缩进是愚蠢的,混合标签和空格.使用python -tt来验证.