我有这个:
d1 = OrderedDict([('a', '1'), ('b', '2')])
Run Code Online (Sandbox Code Playgroud)
如果我这样做:
d1.update({'c':'3'})
Run Code Online (Sandbox Code Playgroud)
然后我明白了:
OrderedDict([('a', '1'), ('b', '2'), ('c', '3')])
Run Code Online (Sandbox Code Playgroud)
但我想要这个:
[('c', '3'), ('a', '1'), ('b', '2')]
Run Code Online (Sandbox Code Playgroud)
没有创建新词典.