Python 길이우선정렬

Jmnote (토론 | 기여)님의 2021년 9월 5일 (일) 15:59 판 (→‎같이 보기)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요[ | ]

Python 길이우선정렬
fruits = ['banana','melon','pineapple','apple','lemon']
fruits.sort(key=lambda s: (len(s),s))
print( fruits )
fruits = ['banana','apple22','apple1','apple2','apple1','apple','lemon']
fruits.sort(key=lambda s: (len(s),s))
print( fruits )
fruits = ['바나나','사과22','사과1','사과2','사과1','사과','레몬']
fruits.sort(key=lambda s: (len(s),s))
print( fruits )

2 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}