I'm in the process of writing a program for the robotics team I'm apart of to gather data during competition to find the best team to "alliance" with. It needs gather about 20 values and needs to be able to list data by various parameters. I have a lot of the framework done but it seems like when I append my data to the list it will change all entries to when I'm appending.
For example, if I have
data = [{"teamNumber":1345,"teamName":"Blah"}]
and try to append
{"teamNumber":3219,"teamName":"TREAD"}
to data using append() I end up with
data = [{"teamNumber":3219,"teamName":"TREAD"},{"teamNumber":3219,"teamName":"TREAD"}]
Currently we are adding data using this function(It has most of the unnecessary "meat" trimmed)
def inputTeamData():
global data
clear()
temp = dataTemplate
temp["teamNumber"] = question("Team Number?: ")
temp["teamName"] = question("Team Name?: ")
temp["foundingSeason"] = question("Founding Season?: ")
save = question("Is the above data correct?(y/n): ")
if save.lower() == "y":
try:
data.append(temp)
except ValueError:
print "ValueError. You gave me the wrong data types"
sleep(1)
else:
print "Not saved"
sleep(.8)
I don't know what gives, even though the answer is more then likely to be stupidly obvious I can't seen to find the problem.
Anyways, much thanks in advice to whoever can help me with this!