Oct-21-2020, 12:39 AM
Update is expecting a sequence, each element of which is a mapping (or a sequence of length 2). So you can't feed it a bare tuple, but you can feed it a list of tuples or a dict created from the tuple.
d = {} item = ('a', 1) d.update(item) # won't work d.update([item]) # okay d.update({item}) # also okayThat suggests that since it has to take a sequence anyway, you could create one by slicing your original dict rather than using a for loop.
from itertools import islice groupA = dict(islice(rev_sorted_dataDict.items(), 0, 38) # or.... groupB = {} groupB.update(islice(rev_sorted_dataDict.items(), 38, 75)