Data Types in Python
Jason Myers
Instructor
.update()
method to update a dictionary from another dictionary, tuples or keywordsprint(galleries_10007)
{'Nyabinghi Africian Gift Shop': '(212) 566-3336'}
art_galleries['10007'] = galleries_10007
galleries_11234 = [ ('A J ARTS LTD', '(718) 763-5473'), ('Doug Meyer Fine Art', '(718) 375-8006'), ('Portrait Gallery', '(718) 377-8762')]
art_galleries['11234'].update(galleries_11234)
print(art_galleries['11234'])
{'Portrait Gallery': '(718) 377-8762',
'A J ARTS LTD': '(718) 763-5473',
'Doug Meyer Fine Art': '(718) 375-8006'}
del
instruction deletes a key/value.pop()
method safely removes a key/value from a dictionary.del art_galleries['11234']
galleries_10310 = art_galleries.pop('10310')
print(galleries_10310)
{'New Dorp Village Antiques Ltd': '(718) 815-2526'}
Data Types in Python