OrderDict能让字典永远保持有序,
小例子,
import json
from collections import OrderedDict
metadata = json.loads(text, object_pairs_hook=OrderedDict); # 读取Json时保持有序
OrderDict能让字典永远保持有序,
小例子,
import json
from collections import OrderedDict
metadata = json.loads(text, object_pairs_hook=OrderedDict); # 读取Json时保持有序