강의

멘토링

커뮤니티

Inflearn Community Q&A

ehdgus50941207's profile image
ehdgus50941207

asked

Python programming that even beginners can learn in one breath

Let's learn dictionaries

dict의 활용

Resolved

Written on

·

241

1

안녕하세요. dict() 함수에 대해 질문이 있습니다.

dict(programmers_list)를 통해 튜플을 딕셔너리형태로 바꾸었는데, 반대로 딕셔너리에서 튜플로 바꾸는 함수는 없나요?

감사합니다.

인프런 신규강의 (무료)python

Answer 1

0

pythonmento님의 프로필 이미지
pythonmento
Instructor

질문 감사드립니다.

딕셔너리의 키:값의 쌍을 하나의 튜플로 변경하여 구성된 리스트로 변경되는 경우를 말씀하시는 건가요?

그렇다면, 아래와 같이 하실 수 있습니다.

>>> programmers = {'Python':14, 'Java':9, 'C++':2}
>>> list(programmers.items())
[('Python', 14), ('Java', 9), ('C++', 2)]
ehdgus50941207님의 프로필 이미지
ehdgus50941207
Questioner

감사합니다!

ehdgus50941207's profile image
ehdgus50941207

asked

Ask a question