python 元组中元组转为字典

 

#create a tuple
tuplex = ((2, "w"),(3, "r"))
print(dict((y, x) for x, y in tuplex))

 

posted @ 2018-11-12 10:22  anobscureretreat  阅读(4344)  评论(0编辑  收藏  举报