Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

access first element of dictionary python


my_dict = {'foo': 'bar', 'spam': 'eggs'}
next(iter(my_dict)) # outputs 'foo'

Source by codefantasy.org #
 
PREVIOUS NEXT
Tagged: #access #element #dictionary #python
ADD COMMENT
Topic
Name
6+1 =