Python Language Dictionary: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 26: Line 26:


=Change a Dictionary=
=Change a Dictionary=
==Individual Elements==
==Change Individual Elements==
Add, modify, delete.
Add, modify, delete.


==Combine Dictionaries==
==Combine Dictionaries==

Revision as of 19:44, 16 February 2022

Internal

Overview

Empty map

m = {}

Access:

d["key"]

Create a Dictionary

Access a Dictionary

Access Individual Elements

[], get()

An attempt to access an inexistent key ends up in a KeyError exception being thrown.

Test the existence of a key.

Get All Keys

Get All Values

Change a Dictionary

Change Individual Elements

Add, modify, delete.

Combine Dictionaries