Python Language Dictionary: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 2: Line 2:
* [[Python_Language#Dictionary|Python Language]]
* [[Python_Language#Dictionary|Python Language]]
=Overview=
=Overview=
Empty map
<syntaxhighlight lang='python'>
m = {}
</syntaxhighlight>
Access:
<syntaxhighlight lang='python'>
d["key"]
</syntaxhighlight>


=Create a Dictionary=
=Create a Dictionary=

Revision as of 19:45, 16 February 2022

Internal

Overview

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