Answers for "extract specific key values from python dictionary"

0

extract values from dict python

>>> d = {1:-0.3246, 2:-0.9185, 3:-3985}

>>> d.values()
<<< [-0.3246, -0.9185, -3985]
Posted by: Guest on January-23-2021
-1

extract specific key values from python dictionary

test_data = [{'id':1, 'value':'one'}, {'id':2, 'value':'two'}, {'id':3, 'value':'three'}]

generator = ( item['value'] for item in test_data )

...

for i in generator:
    do_something(i)
Posted by: Guest on March-06-2021

Code answers related to "extract specific key values from python dictionary"

Python Answers by Framework

Browse Popular Code Answers by Language