You should restructure your dictionary similar to:
the way that you have it sort of defeats the purpose of having a dictionary in the first place.
If written like above, you can add and remove information very easily, and access any way you wish.
for sorting by value, refer to this post: https://python-forum.io/Thread-sorting-n...-to-values
and this article: https://www.blog.pythonlibrary.org/2012/...-by-value/
Additional - post edit
you can save a large dictionary as a JSON file, and read it in simply wherever needed. I usually create my dictionaries in a separate script, save as JSON and then read a=in as needed, here's code (haven't tested, but I think it's correct) to do that:
movie_dict = { '2006': { 'The Prestige': { 'director': 'Christopher Nolan', # then can add additional information about movie, like: 'actors': { 'stars': { 'Hugh Jackman': { 'role': 'Robert Angier - rival stage magician in London at the end of the 19th century', '...': '...' }, 'Christian Bale': { 'role': 'Alfred Borden' } } } }, 'The Departed': { 'director': 'Martin Scorsese', 'writer': 'William Monahan', 'actors': { '...': '...' } } } }'...' just indicates where you would add additional information
the way that you have it sort of defeats the purpose of having a dictionary in the first place.
If written like above, you can add and remove information very easily, and access any way you wish.
for sorting by value, refer to this post: https://python-forum.io/Thread-sorting-n...-to-values
and this article: https://www.blog.pythonlibrary.org/2012/...-by-value/
Additional - post edit
you can save a large dictionary as a JSON file, and read it in simply wherever needed. I usually create my dictionaries in a separate script, save as JSON and then read a=in as needed, here's code (haven't tested, but I think it's correct) to do that:
import json def save_json(dictname, filename): with open(filename, 'w') as fp: json.dump(dictname, fp) def load_json(dictname, filename): dictname = json.load(fp)