a = [1,2,3]
b = a.sort()
print(b)
这个的运行结果为什么是None?
另外:
b = sorted(a) 是OK的,
b = sort(a) 却是不合法的。为什么?
盼指点。
a = [1,2,3]
b = a.sort()
print(b)
这个的运行结果为什么是None?
另外:
b = sorted(a) 是OK的,
b = sort(a) 却是不合法的。为什么?
盼指点。
收起
a.sort()是无返回值的
print(a)
sort()函数是列表的方法,不是python内置函数,list.sort()
sorted()是内置函数,有返回值
报告相同问题?