ok, I feel stupid, but there must be a better way than this! (finding name of unique key in dict)

Tobiah toby at tobiah.org
Fri Jan 20 11:06:54 EST 2023


On 1/20/23 07:29, Dino wrote:
> 
> let's say I have this list of nested dicts:
> 
> [
>    { "some_key": {'a':1, 'b':2}},
>    { "some_other_key": {'a':3, 'b':4}}
> ]
> 
> I need to turn this into:
> 
> [
>    { "value": "some_key", 'a':1, 'b':2},
>    { "value": "some_other_key", 'a':3, 'b':4}
> ]

This doesn't look like the program output you're getting.






More information about the Python-list mailing list