상세 컨텐츠

본문 제목

자료구조 - dictionary

Programming/Python

by 쌩우 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')

'Programming > Python' 카테고리의 다른 글

dictionary + iteration 딕셔너리와 반복문  (0) 2019.07.22
PIP와 Virtualenv  (0) 2019.07.22
모듈 만들기  (0) 2019.07.21
모듈 사용하기  (0) 2019.07.21
for 반복문  (0) 2019.07.21

관련글 더보기

댓글 영역