''
列表sort函数

sort函数的功能
    对当前列表按照一定规律进行排序

sort函数用法
    用法:
    list.sort(cmp=None,key=None,reverse=False)
    参数:
        cmp -- 可选参数,制定排序方案的函数
        key - 参数比较
        reverse --排序规则,reverse=True降序,reverse = False升序(默认)
        cmp与key涉及函数学习,我们在日后讲解当前默认不传即可
    使用:
    books = ['python','diango','web','flask','tornado']
    print(books.sort())
    print(books)

sort函数注意事项
    列表中的元素类型必须相同,否则无法排序(报错)
'''

shu = '01鼠'
niu = '02牛'
hu = '03虎'
tu = '04兔'
long = '05龙'
she = '06蛇'
ma = '07马'
ya = '08羊'
hou = '09猴'
ji = '10鸡'
gou = '11狗'
zhu = '12猪'

shengxiao = []
shengxiao.append(gou)
shengxiao.append(ji)
shengxiao.append(zhu)
shengxiao.append(she)
shengxiao.append(tu)
shengxiao.append(hou)
shengxiao.append(hu)
shengxiao.append(niu)
shengxiao.append(shu)
shengxiao.append(long)
shengxiao.append(ma)
shengxiao.append(ya)

print(shengxiao)
print(len(shengxiao))
shengxiao.sort() #升序显示
print(shengxiao)


shengxiao.sort(reverse=True)
print(shengxiao)

mix = ['python','Java',{'name':'Tom'}]
# mix.sort()
# print(mix) # 报错 TypeError: '<' not supported between instances of 'dict' and 'str'


list1 = [52,35,64,20,14,59]
list1.sort() #升序
print(list1)
list1.sort(reverse=True) #降序
print(list1)