언어/python

딕셔너리의 items( ) 함수

lika-7 2023. 12. 23. 22:22

안녕하세요 lika-7입니다

이번시간에는 딕셔너리의 items( )을 반복문에서 사용하는 대해서 다루겠습니다.

example_dictionary = {
    "키A": "값A",
    "키B": "값B",
    "키C": "값C",
}
for key, element in example_dictionary.items():
    print("dictionary[{}] = {}".format(key, element))

딕셔너리와 items( ) 함수를 사용하면 키와 값을 조합해서 쉽게 키, 값에 접근 할 수 있습니다.