Hello Stack Overflow,
What is the most readable + simplest way to get a value from a dictionary that only contains one key-value pair?
Note: I do not know what the key is when I try to fetch the value, it's autogenerated.
Let's imagine the dictionary to look something like this:
my_dict = {
"unknown_key_name": 1
}
FYI I am using Python 3.6. My current solution is this: val = list(my_dict.values())[0]
I just have a feeling there is a more "elegant" solution, does anyone know of one?