Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to print specific values from dict_items?

I have a dict_items called results which contains the following:

dict_items([('rouge-1', {'r': 1.0, 'p': 1.0, 'f': 0.999999995}), ('rouge-2', {'r': 1.0, 'p': 1.0, 'f': 0.999999995}), ('rouge-l', {'r': 1.0, 'p': 1.0, 'f': 0.999999995})])

What I want to do is to extract the values of f from all items rouge-1, rouge-2 and rouge-l

How can I do it?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Try:

results = get_scores()  # <-- the results contains your dict_item(...)

for k, v in results:
    print(k, v["f"])
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading