I have dictionary in the form of:
dict_one = { key2: [val1, val2, val3], key2: [val1, val2, val3] }
I want to remove 'val3' from every element in the dictionary. I believe this should be possible via a for loop but I can't seem to get it correct. I've tried the following:
for lst in dict_one:
dict_one.pop(dict_one[lst][2])
This is intended, I believe, to remove both key and value. It returned a 'keyerror' error message. dict_one.remove() is clearly not going to work as it's meant for lists. It seems like what I'm trying to do should be relatively simple but I seem to be missing something.
(FYI, it seems like if I only wanted to delete a subset of the 'val3' items, I could follow the approach here: Remove element in dictionary of lists)