【发布时间】:2016-02-02 09:40:53
【问题描述】:
考虑:
代码
class sand:
def __init__(self):
print("I am a pickle")
def next(self):
print("I am a tuner")
测试和输出
>>> x = sand()
I am a pickle
>>> x.next()
Traceback (most recent call last):
File "<pyshell#26>", line 1, in <module>
x.next()
AttributeError: 'sand' object has no attribute 'next'
【问题讨论】:
标签: python class object methods