问题:python中list的sort()方法与sorted方法有什么区别
解决:自己测试一下
方法:
a = [1,2,4,6,3,2]
a.sort()
此时 a:[1, 2, 2, 3, 4, 6]
b = [1,2,4,6,3,2]
c = sorted(b)
此时 c:[1, 2, 2, 3, 4, 6] b:[1,2,4,6,3,2]
问题:python中list的sort()方法与sorted方法有什么区别
解决:自己测试一下
方法:
a = [1,2,4,6,3,2]
a.sort()
此时 a:[1, 2, 2, 3, 4, 6]
b = [1,2,4,6,3,2]
c = sorted(b)
此时 c:[1, 2, 2, 3, 4, 6] b:[1,2,4,6,3,2]