我使用返回的json在python中创建dict。在
其中一个值我想成为shortuuid,所以我把一个函数作为值。 我希望调用该函数,并将该值替换为该函数返回的值。在
这是对的吗?在
tvMSG = {'fromEMAIL': uEmail, 'toCHANNELID': channelID, 'timeSENT': uTime}
for msgkey, subdict, instakey in (('profilePIC', 'user', 'profile_picture'),
('userNAME', 'user', 'username'),
('msgBODY', 'caption', 'text'),
('mainCONTENT','images', 'standard_resolution',)
('tvshowID', shortuuid.uuid())):
this is the key/value in question:
('tvshowID', shortuuid.uuid())):
这是我得到的错误:
^{pr2}$如果没有,我该怎么做?在
谢谢你的提示@ThierryJ。在
不需要进行任何迭代。 我只是把这个调用从循环中取出,放到循环上面的变量中。在
错误来自于缺少逗号。行:
实际上应该是:
^{pr2}$这就是为什么你得到错误
'tuple' object is not callable
,你调用了('any','tuple')('arguments')
。在相关问题 更多 >
编程相关推荐