Python sort后赋值 操作陷阱

x=[1,4,2,0]  

# 错误的方式,因为sort没有返回值
y=x.sort()    
type (y)     #NoneType  

#正确的方式
x.sort()
y=x[:]
原文地址:https://www.cnblogs.com/master-pokemon/p/5728200.html