Python sorted()
사용 버전 : Python 3.6.8
사용 프로그램 : Atom 1.34.0 x64
괄호 안에는 list나 dictionary 형식이 들어갑니다.
이름에서 알 수 있듯이 크기 순으로 정렬을 해줍니다.
숫자는 크기 별로 정렬합니다.


글자는 사전 순서상으로 정렬합니다.
대문자, 소문자 따로 구분하니, 알파뱃 순서로 정렬하려면, 모든 글자를 하나의 case로 맞추는 게 좋겠네요.


dictionary 형태는 key 값을 정렬해서 보여줍니다.


만약, value 값의 크기로 정렬하고 싶다면 다음과 같이 나타냅니다.


reverse 속성을 사용하면, 역순으로 정렬할 수 있습니다.


끝.
사용 프로그램 : Atom 1.34.0 x64
파이썬 sorted()에 대해서 알아보겠습니다.
괄호 안에는 list나 dictionary 형식이 들어갑니다.
이름에서 알 수 있듯이 크기 순으로 정렬을 해줍니다.
숫자는 크기 별로 정렬합니다.


글자는 사전 순서상으로 정렬합니다.
대문자, 소문자 따로 구분하니, 알파뱃 순서로 정렬하려면, 모든 글자를 하나의 case로 맞추는 게 좋겠네요.


dictionary 형태는 key 값을 정렬해서 보여줍니다.


만약, value 값의 크기로 정렬하고 싶다면 다음과 같이 나타냅니다.


reverse 속성을 사용하면, 역순으로 정렬할 수 있습니다.


끝.
카테고리: Standard Library, Python
댓글
댓글 쓰기
궁금한 점은 댓글 달아주세요.
Comment if you have any questions.