【问题标题】:Functions and variable assignment Python [duplicate]函数和变量赋值Python [重复] 【发布时间】:2015-03-21 06:56:25 【问题描述】: a=[8,2,15,6,1] a = a.sort() print a 为什么打印None?您能详细说明所有功能吗? 【问题讨论】: 不要将 a.sort() 分配给 a。只需对其进行排序并打印一个 标签: python list sorting 【解决方案1】: sort() 和 sorted() 不同: sort() 对列表进行就地排序并返回 None。 sorted() 创建一个新列表并将其返回。 更多详情请参阅here。 【讨论】: