为什么dicts可以在python2中订购,但在python3中却没有?我在文档中的任何地方都找不到它.
Python 3.3.4 (default, Feb 11 2014, 16:14:21)
>>> sorted([{'a':'a'},{'b':'b'}])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unorderable types: dict() < dict()
Run Code Online (Sandbox Code Playgroud)
与
Python 2.7.6 (default, Feb 26 2014, 12:01:28)
>>> sorted([{'a':'a'},{'b':'b'}])
[{'a': 'a'}, {'b': 'b'}
Run Code Online (Sandbox Code Playgroud)