Nested dictionary comprehension python

前端 未结 3 655
走了就别回头了
走了就别回头了 2020-11-30 02:21

I\'m having trouble understanding nested dictionary comprehensions in Python 3. The result I\'m getting from the example below outputs the correct structure without error,

3条回答
  •  一向
    一向 (楼主)
    2020-11-30 02:54

    {ok: {ik: myfunc(iv) for ik, iv in ov.items()} for ok, ov in od.items()}  
    

    where
    ok-outer key
    ik-inner key
    ov-outer value
    iv-inner value od-outer dictionary This is how i remember.

提交回复
热议问题