Dictionary to tuple
Odd-R.
oddr at home.no.no
Tue Jun 28 10:45:19 EDT 2005
I have a dictionary, and I want to convert it to a tuple,
that is, I want each key - value pair in the dictionary
to be a tuple in a tuple.
If this is the dictionary {1:'one',2:'two',3:'three'},
then I want this to be the resulting tuple:
((1,'one'),(2,'two'),(3,'three')).
I have been trying for quite some time now, but I do not
get the result as I want it. Can this be done, or is it not
possible?
I must also add that I'm new to Python.
Thanks in advance.
--
Har du et kjøleskap, har du en TV
så har du alt du trenger for å leve
-Jokke & Valentinerne
More information about the Python-list
mailing list