-1
我有一个字典的实例。我怎样才能修改字典中的字典,由字典中的键?python,如何修改类实例的字典属性
class myclass:
def __init__(self):
self.mydict = {'number':0}
def myfunction(foo):
foo.mydict[number] += 10 #<- doesnt work gives me 'global name number not defined'
instance = myclass()
myfunction(instance)
希望你能帮助我, 谢谢!
bwaaaa。但当然,在这里4:20,可能会更好地称它为夜晚...... thx很多 – 2013-02-09 03:19:55