【发布时间】:2013-02-03 13:42:28
【问题描述】:
我在 python 中尝试了这段代码,它运行良好:
listX.sort()
list1.sort()
result = listX + list1
但以下代码不起作用:
result = listX.sort() + list1.sort()
它给了我这个错误信息:
TypeError: unsupported operand type(s) for +: 'NoneType' and 'NoneType'
我该如何解决这个问题?谢谢!
【问题讨论】:
-
除了作为一个副本之外,Python 常见问题解答中也回答了这个问题(甚至解释了 为什么 Python 是这样设计的)。