python应用操作——字典转元组(列表list) dict -> tuple
提问人:ylm发布时间: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)
继续查找其他问题的答案?
相关视频回答
回复(0)
点击加载更多评论>>