pythonjw 2019-02-12
方法一:
def dict_to_numpy_method1(dict): dict_sorted=sorted(dict.iteritems(), key=lambda d:d[0]) results=[value for key,value in dict_sorted]
方法二:
def dict_to_numpy_method2(dict): keys=dict.keys() keys.sort() results=[dic[key] for key in keys]
方法三:
def dict_to_numpy_method3(dict): keys=dict.keys() keys.sort() results=map(dict.get,keys)