简体   繁体   中英

How can I append a value to a dictionary key with multiple "values"?

For example:

mydict = {'Jan':[1,2,3]}

How can I add another value to that key? I tried the update method but that just overwrites the entire key.

Any help is appreciated thanks!

尝试这个:

mydict['Jan'].append('value')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM