I have this dictionary filled with keys (each key is a tuple) and value None for each key. I want to add values (one at a time) within a for loop to the keys, without overwriting values
This code has an error message " AttributeError: 'NoneType' object has no attribute 'append' "
dictionary1={}
dictionary1.update( {(0,0) : None} )
listOfTuples=[(0,0),(1,0),(9,0)]
for x in range(3):
dictionary1[(0,0)].append(listOfTuples(x))
The result i want is the dictionary1 to be like:
{ (0,0) : [(0,0),(1,0),(9,0)] }
But i want it to be filled in the for loop one tuple at a time