On 2019-06-28, Larry Martell <larry.mart...@gmail.com> wrote: > On Fri, Jun 28, 2019 at 11:10 AM CrazyVideoGamez ><jasonanyil...@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? > > Dicts are not ordered. If you need that use an OrderedDict > (https://docs.python.org/3.7/library/collections.html#collections.OrderedDict)
This is no longer true from Python 3.6 onwards - dicts are ordered. There's no way to insert an item anywhere other than at the end though. -- https://mail.python.org/mailman/listinfo/python-list