DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
SCRIPT & CODE EXAMPLE
CODE EXAMPLE FOR PYTHON
python dictionary append value if key exists
from
collections
import
defaultdict d
=
defaultdict
(
list
)
d
[
'key'
]
.
append
(
'mykey'
)
Source by stackoverflow.com #
PREVIOUS
NEXT
Tagged:
#python
#dictionary
#append
#key
#exists
ADD COMMENT
Topic
COMMENT
Name
4+4 =
Submit