Basic Python dictionary question

dictionary, python

Solution

A better solution is to store your value as a two-tuple:

d = {'key' : ('value1', 'value2')}

That way you don't have to split every time you want to access the values.

Problem

I have a dictionary with one key and two values and I want to set each value to a separate variable. d= {'key' : ('value1, value2'), 'key2' : ('value3, value4'), 'key3' : ('value5, value6')} I tried d[key][0] in the hope it would return "value1" but instead it return "v" Any suggestions?

Original source