Python per utenti MATLAB
Justin Kiggins
Product Manager
type(definitions)
dict
print(definitions['aardvark'])
Un mammifero notturno scavatori con orecchie lunghe, muso tubolare e lunga
lingua estensibile, che si nutre di formiche e termiti. Gli oritteropi sono nativi
dell'Africa e non hanno stretti parenti.
# Crea un dizionario
dog = {'name': 'Toby', 'breed': 'Basset Hound'}
# Aggiungi altre coppie chiave:valore
dog['weight (lbs)'] = 552.3
dog['birthdate'] = "2016-06-26"
print(dog)
{'name': 'Toby',
'breed': 'Basset Hound',
'weight (lbs)': 552.3,
'birthdate': '2016-06-26'}
# Aggiorna il valore del peso dog['weight (lbs)'] = 52.3print(dog)
{'name': 'Toby',
'breed': 'Basset Hound',
'weight (lbs)': 52.3,
'birthdate': '2016-06-26'}
dog.pop('birthdate')
print(dog)
{'name': 'Toby',
'breed': 'Basset Hound',
'weight (lbs)': 52.3}
Python per utenti MATLAB