我有一个简单的字典:
{"keyy":{"key": "value", "cey": "value"}, "kaye":{"key": "value"}}
我想编码为“上下文感知”元组:
[("keyy","key","value"), ("keyy","cey","value"), ("kaye","key","value")]
我对ValueError: too many values to unpack的尝试:
if __name__=='__main__':
mydict={"keyy":{"key": "value", "cey": "value"}, "kaye":{"key", "value"}}
mytuplelist=[tuple(k,v,val) for (k,v) in [(key,val) for (key,val) in mydict]]
print mytuplelist
我将如何创建这个元组列表?