Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #extract #specific #key #values #python #dictionary
ADD COMMENT
Topic
Name
5+3 =