Programming/Python
자료구조 - dictionary
쌩우
2019. 7. 21. 22:31
dictionary
javascript의 객체와 같은 자료구조라고 생각하면 된다.
ditionary의 선언과 호출
dictionary = { 'key': 'value', 'ex': [1, 2, 3] } print(dictionary['key']) # 'value'
dictionary의 삭제
dictionary = { 'one': 1, 'two': 2 } # 'one'에 해당하는 값을 없애고 싶을 땐? del(dictionary['one']) # 또 다른 방법은 pop dictionary.pop('two')