Python

[Python] sorted 함수가 str과 int 를 정열하는 방법

insub4067 2022. 1. 27. 17:16
str_numbers = ["6","10","2","11"]
int_numbers = [6,10,2,11]

print(sorted(str_numbers))
=> ['10', '11', '2', '6']

print(sorted(int_numbers))
=>[2, 6, 10, 11]