如何在列表python中对字符串数据进行排序?

时间:2019-05-24 14:10:40

标签: python list

如何从python列表中排序数据?

my_list = ['s1 = cat','s2 = dog','s333 = bird' , 's4 = ant', 's5 = alice','s3 = zoo']

my_list.sort()
['s1 = cat', 's2 = dog', 's3 = zoo', 's333 = bird', 's4 = ant', 's5 = alice']

My expected output
['s1 = cat', 's2 = dog', 's3 = zoo', 's4 = ant', 's5 = alice', 's333 = bird']

0 个答案:

没有答案