딕셔너리 items()

송용진·2023년 8월 5일
0

key와 value를 둘 다 가져와야 할 때에는 items()를 사용하면 됩니다.

ages = {'Tod' : 35, 'Jane' : 23, 'Paul' : 62}

for key, value in ages.items():
    print('{}의 나이는 {} 입니다'.format(key, value))
    
profile
아이디어가 샘이솟아

0개의 댓글