How do you insert an item into a dictionary (in python 3.7.2)?
Calvin Spealman
cspealma at redhat.com
Fri Jun 28 11:16:45 EDT 2019
You simply assign to the key, like so:
dictionary[3] = 'value2'
But it isn't clear what you mean by "in the middle".
On Fri, Jun 28, 2019 at 11:10 AM CrazyVideoGamez <jasonanyilian at gmail.com>
wrote:
> How do you insert an item into a dictionary? For example, I make a
> dictionary called "dictionary".
>
> dictionary = {1: 'value1', 2: 'value3'}
>
> What if I wanted to add a value2 in the middle of value1 and value3?
> --
> https://mail.python.org/mailman/listinfo/python-list
>
--
CALVIN SPEALMAN
SENIOR QUALITY ENGINEER
cspealma at redhat.com M: +1.336.210.5107
[image: https://red.ht/sig] <https://red.ht/sig>
TRIED. TESTED. TRUSTED. <https://redhat.com/trusted>
More information about the Python-list
mailing list