Python diccionario anexar el valor y la clave

Ejemplos de código

5
0

N

dict = {1 : 'one', 2 : 'two'}
# Print out the dict
print(dict)
# Add something to it
dict[3] = 'three'
# Print it out to see it has changed
print(dict)
4
0

N

dict_1 = {"1":"a", "2":"b", "3":"c"}
dict_2 = {"4":"d", "5":"e", "6":"f"}

dict_1.update(dict_2) 
print(dict_1)
#Output = {"1":"a", "2":"b", "3":"c", "4":"d", "5":"e", "6":"f"}

Páginas relacionadas

Páginas de ejemplo relacionadas

En otros idiomas

Esta página está en otros idiomas

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................