I have a tuple that contains multiple sub tuples, with a fixed length of two and each sub tuple has two string values.
NOTE: The length and value type of these sub tuples never change.
I'd like to use the sub tuples in a dictionary-comprehension, like this:
{sub_tuple for sub_tuple in main_tuple}
The problem is, I get:
{(w, x), (y, z)}
Instead of:
{w: x, y: z}
How can I get this to work without creating any additional variables?
For example, how do I avoid doing something like this:
x = {}
for sub_tuple in main_tuple:
x[sub_tuple[0]] = sub_tuple[1]
# do whatever with x...