Answers for "python tuple to dict"

0

python tuple to dict

>>> t = ((1, 'a'),(2, 'b'))
>>> dict((y, x) for x, y in t)
{'a': 1, 'b': 2}
Posted by: Guest on January-17-2022

Python Answers by Framework

Browse Popular Code Answers by Language