这应该是很基本的。我有一门课,其中一个特点就是名字。 在这个程序中,我有两个这样的类——一个类的名称起作用,例如someclass.name显示了另一个类的名称,而另一个类的名称不起作用。我一直在研究类型,试图找出什么出轨了,但没有成功。
class someotherthing(object):
def __init__(self, name=None, revisions = 0):
self.name = name
self.revisions = 0
examplething = someotherthing()
examplething.name = str(myname).strip() #added strip() while brainstorming
listofthings.append(examplething)
for thing in listofthings:
print thing.name
我取得的成果是:
thing.name: <built-in method strip of str object at 0x1318930>
目前没有回答
相关问题 更多 >
编程相关推荐