Advertisement
mmyjh86

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

Nov 7th, 2019
347
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.11 KB | None | 0 0
  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}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement