mmyjh86

[위키독스] 리스트를 딕셔너리로 변환

Nov 7th, 2019
164
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. my_list = ["a", "b", "c", "d"]
  2. my_dict = {x:1 for x in my_list}
  3.  
  4. print(my_dict)
  5. # {'a': 1, 'b': 1, 'c': 1, 'd': 1}
RAW Paste Data