python 元組中元組轉爲字典

 

#create a tuple
tuplex = ((2, "w"),(3, "r"))
print(dict((y, x) for x, y in tuplex))
相關文章
相關標籤/搜索