python應用操作——?字典轉元組(列表list) dict -> tuple
提問人:ylm發(fā)布時間:2020-09-29
1.將鍵key轉成元組
name_dict = {'name_1':'Zarten_1', 'name_2' : 'Zarten_2'}name_tuple = tuple(name_dict) #列表-list即可print(type(name_tuple), name_tuple)
2.將值value轉成元組
name_dict = {'name_1':'Zarten_1', 'name_2' : 'Zarten_2'}name_tuple = tuple(name_dict.values())print(type(name_tuple), name_tuple)
繼續(xù)查找其他問題的答案?
相關視頻回答
點擊加載更多評論>>