python ----兩個列表(list)合併成字典

python ----兩個列表(list)合併成字典: 使用zip函數, 把key和value的list組合在一起, 再轉成字典(dict). **代碼:** keys = ['a', 'b', 'c'] values = [1, 2, 3] dictionary = dict(zip(keys, values)) print (dictionary) """ **輸出:** {'a': 1, '
相關文章
相關標籤/搜索