I create two identical dictionaries containing lists using two different methods:
dictA = dict.fromkeys(["key1", "key2"], [])
dictB = {
"key1": [],
"key2": [],
}
Yet, when I append a random value or list to a specific key of each dictionary:
dictA["key2"].append(1)
dictB["key2"].append(1)
...I end up with different results:
{'key1': [1], 'key2': [1]}
{'key1': [], 'key2': [1]}
Why is that?