An ordered dictionary would get you what you need
from collections import OrderedDict
If you want to order your items in lexicographic order, then do the following
d1 = {'climate': 10, 'ecosystem': 1, 'energy': 6, 'human': 1, 'world': 2, 'renewable': 2, 'native': 2}
od = OrderedDict(sorted(d1.items(), key=lambda t: t[0]))
Contents of od
:
OrderedDict([('climate', 10),
('ecosystem', 1),
('energy', 6),
('human', 1),
('native', 2),
('renewable', 2),
('world', 2)])
If you want to specify exactly which order you want your dictionary, then store them as tuples and store them in that order.
t1 = [('climate',10), ('ecosystem', 1), ('energy',6), ('human', 1), ('world', 2), ('renewable', 2), ('native', 2)]
od = OrderedDict()
for (key, value) in t1:
od[key] = value
od
is now
OrderedDict([('climate', 10),
('ecosystem', 1),
('energy', 6),
('human', 1),
('world', 2),
('renewable', 2),
('native', 2)])
In use, it is just like a normal dictionary, but with its internal contents' order specified.