python提取字典的key列表,这段代码可以把字典的所有key输出为一个数组
d2 = {'spam': 2, 'ham': 1, 'eggs': 3} # make a dictionary print d2 # order is scrambled print d2.keys() # create a new list of my keys
python提取字典的key列表,这段代码可以把字典的所有key输出为一个数组
d2 = {'spam': 2, 'ham': 1, 'eggs': 3} # make a dictionary print d2 # order is scrambled print d2.keys() # create a new list of my keys