我正在尝试从字典中的某个点拆分字典。似乎做一个简单的items_dict[3:]
工作,但它没有工作。
items_dict = {
"Cannon barrels":10,
"Cannon furnace":12,
"Candle":36,
"Bronze arrowheads":39,
"Iron arrowheads":40,
"Steel arrowheads":41,
"Mithril arrowheads":42,
"Adamant arrowheads":4
}
print items_dict[3:] # Nope, this won't work
print items_dict["Candle"] # This will of course, but only returns the Candle's number
我只知道如何通过以某个字符串开头的键对字典进行切片,但我只想知道如何对类似于列表的字典进行切片。