Python Learning
Thursday, 9 April 2020
Python dict how to create key or append an element to key?
Use
dict.setdefault()
:
dic
.
setdefault
(
key
,[]).
append
(
value
)
from :
https://stackoverflow.com/questions/12905999/python-dict-how-to-create-key-or-append-an-element-to-key/12906014
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment