Словарь среза Python
# Import the itertools libarary
# This library ships with Python 3 so you don't have to download anything
# It provides a bunch of tools for dealing with sequences and iteration
import itertools
# Create a new dictionary variable
myDictionary = {
"name": "Fred",
"animal": "cat",
"colour": "red",
"age": 3
}
# Create a sliced dictionary
# dict() is used to convert the iterable result of itertools.islice() to a new dictionary
slicedDict = dict(itertools.islice(myDictionary.items(), 1 ,3))
print(slicedDict)
# Prints out
# {
# 'animal': 'cat',
# 'colour': 'red'
# }
Tofufu