python代码如下:
def init(data):
data["last"]={}
data["first"]={}
storage={}
init(storage)
storage['first']='Chen'
storage['last']='LinHua'
def lookup(data,label,name):
return data[label].get(name)
print(storage)
lookup(storage,'first','Chen')
运行结果显示:'str' object has no attribute 'get'
求大神告诉我如何修改代码,想通过lookup()函数找到字典中的键
谢谢!!!!