I apologize in advance as this is not much of a Maya question but I am
trying to convert this 'list' within nested dictionaries into a dictionary
type.
I had a function where it ingests in a nested dictionary and allows me to
sort the contents by a specified value eg. name.
This is a portion of it -
return {k: {'entries': sorted([v1 for _,v1 in v['entries'].items()], key=
lambda el: el['name'])} for k,v in dict_data.items()}
However, possibly because I am using [] which returns me a list type.
What I am expecting in the output is something as follow:
{'my test':
{
'entries': {
'name': 'running_slow_v001'
...
},
...
}
}
but I am getting:
{'my test':
{
'entries': [{
'name': 'running_slow_v001'
...
}],
...
}
}
I tried using `dict()` and tested the placement anywhere within the return
sentence, it will returns me an error.
Appreciate in advance for any replies.
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/8f6ab8cf-b239-4713-8ef7-3deeb86075dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.