我想在python 3中创建自己的字典类,它有一个字典变量和setitem和getitem方法的字段。虽然,由于某种原因,它并不起作用。试图环顾四周,但找不到答案。python 3 self class dict
class myDictionary:
def __init(self):
self.myDic={}
def __setitem__(self, key, value):
self.myDic[key]=value
我越来越:
'myDictionary' object has no attribute 'myDic'
任何想法? :)
这应该是'__init__',不'__init' – millimoose
__init __(个体经营): –