It is easier to explain with an example to make my question clearer:
For example:
example_dict = {1 : "A", 2 : "B", 3 : "C", 4 : "D", 5 : "E"}
Imagining that I want to start my iteration on key 3 in order to get the corresponding values ??until iterating to it again.
# Chosen the key = 3 will return:
["C","D","E","A","B"]
So what is the best way to iterate from a key to itself?
Is the iteration supposed to reach the end of the dictionary and go back to iterating from the beginning until it finds the key chosen initially?
Another example:
example_dict = {23 : "Hello", 3 : "Bye", 11 : "Shame", 45 : "Nice", 2 : "Pretty"}
# Chosen the key = 3 will return:
["Bye","Shame","Nice","Pretty","Hello"]
question from:
https://stackoverflow.com/questions/66051683/how-to-iterate-over-python-dict-from-the-chosen-key-to-it-again 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…