我有以下代码
histos = dict()
for key in list:
obj = file.Get(key)
if not key in histos:
histos[key] = obj.Clone()
else
histos[key].Add(obj)
Add()
是obj
的函数,但是如果从python dict()
中检索到对象,则会出现以下错误:
Traceback (most recent call last):
File "./script.py", line 35, in <module>
histos[key].Add(obj)
AttributeError: 'PyROOT_NoneType' object has no attribute 'Add'
如何对从dict()