Your formulation seems to show you didn't grasp correctly what are dict in python. This also makes it difficult for us to understand what you want.
For instance:
I want to add values to my dictionary keys.
Is ambiguous (at least) and could be interpreted in several ways. I'll explain what is ambiguous in the following answer.
Even your original example was not helping, as it is not valid syntax:
>>> {"Object": "Computer", "Mouse"}
SyntaxError: invalid syntax
The vocabulary of dict is about key and values.
In a dict every key has a value and only one.
So here's the question you'll have to answer: What is "Mouse" ? a key or a value of dictio, or none of them ?
Either you wanted:
>>> {"Object": "Computer", "Mouse": "A Sample Value"}
Which is a dictionary with a new pair of key/value. It can be done like this:
>>> dictio["Mouse"] = "A Sample Value"
Or perhaps you wanted to 'add' another value to the already stored value for the key "Object" in the dictionary. But 'adding' a value is ambiguous when speaking of a value in a dict, as dictionaries holds only one value for one key !
- Do you want the current string value to be concatenated with a new one ?
- Or do you want to replace the current string value with a list of values ? (If yes, your starting value should have been a list of one element in the first place).
The resulting dict using a list as value for the key "Object" would be:
>>> {"Object": ["My Computer", "Mouse"]}
So this would remain a one key dict, with one value. This value happens to be a list of value, it means that it self, it can hold several inner values in a specific order.
Notice that if I want to start from your original dictio to get the previous result, I have to replace the value "Computer" (of type string) with a different value of different type: ["My Computer", "Mouse"] (it is a list of values).
So this could be done like this:
>>> dictio["Object"] = [dictio["Object"], "Mouse"]
But, this is not very natural and you would probably want to start with a dictio like this:
>>> dictio = {"Object": ["Mouse"]}
Then, 'adding' a value to a list is not anymore ambiguous. And then it would also be simpler to achieve:
>>> dictio["Object"].append("Mouse")
I hope reading this helped you to better grasp what are dicts in python. You should probably find tutorials or basic docs about dictionaries as you seem to have missed some fundamental notions.
{"Object": ["Computer", "Mouse"]}Try to initialize the dictionary with your resulting dictio, and you will know what i mean