개발

딕셔너리(Dictionary)

jih0ssang 2023. 11. 26. 15:06

딕셔너리

lux = {}

lux = {'health': 490, 'mana': 334, 'melee': 550, 'armor': 18.72}

 

딕셔너리 추가

dict['three'] = 3

 

딕셔너리 삭제

dict.pop('one') 또는

del(dict['one'])

 

x = {‘a’: 10, ‘b’: 20}

for item in x.items() # key,value 모두

for key in x.keys() # keys = 키만

for value in x.values() # values = 값만