python和tryton 我很困惑,爲什麼我不能得到我想要的期望值;我不知道什麼是錯的。蟒蛇for循環和字典
比方說self.pendingapr
有場itemdescription
並有3項指標,總有small
,medium
,large
在itemdescriptions
。我真的不知道,如果這個問題的是在for循環:
global M2Mdic
global M2Mldic2
M2Mdic = {}
M2Mldic2 = {}
res = {}
for x in self.pendingapr:
M2Mdic['itemdescription'] = str(x.itemdescription)
M2Mldic2[x.id] = M2Mdic
當我打印M2Mldic2它給了我
>>> {1:'large',2:'large',3:'large'}
當我需要/和期待是
>>> {1:'small',2:'medium',3:'large'}
你好感謝你所有的答案,這減輕了我的心。其實你所有的答案都值得檢查。但我不能..所以我排列你的答覆。謝謝! – Katherina 2013-04-25 12:30:05