에 의해 정렬 된 DICT에서 값 쌍 나는 단지 (쌍은 키으로 분류되어 있습니다)를 딕셔너리의 키/값 쌍을 인쇄하려면 다음과 같은 코드가 있습니다 그러나순회 키 이상/키
for word, count in sorted(count_words(filename).items()):
print word, count
을, 대신 items()
의 iteritems()
하나는 내가이 상황에서 선택해야 동일한 출력 지금
을 생산 호출? 나는 Python tutorial과상의했지만 실제로 내 질문에는 답하지 않습니다.
+1 와우! 나는 이런 존재를 몰랐다. 매우 편리! – helpermethod
3.x에서 iteritems deprecation을 언급 한 +1 –