DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
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
COMMENT
Name
8+8 =
Submit