On 1/20/2023 11:06 AM, Tobiah wrote:
On 1/20/23 07:29, Dino wrote:


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

you are right that I tweaked the name of fields and variables manually (forgot a couple of places, my bad) to illustrate the problem more generally, but hopefully you get the spirit.

        "value": cn,
        "a": cd[cn]["a"],
        "b": cd[cn]["b"]

Anyway, the key point (ooops, a pun) is if there's a more elegant way to do this (i.e. get a reference to the unique key in a dict() when the key is unknown):

cn = list(cd.keys())[0] # There must be a better way than this!

Thanks

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to