I’m new to Python and have only worked with lists briefly in one other language. I have an list of lists. My inside lists are composed of a name and a time. So the structure is something like this:
alarms=[ [“chip”,“10:00”], [“sam”,“7:00”], [“susan”,“5:30”] ]
I have a for loop that I use to run through the list looking for specific names.
for x in alarms:
if x[0]==searchstr:
self.log("Found it")
break
self.log("x={}".format(x))
When I am outside the loop, x prints out the correct list, x[0] prints out the name and x[1] prints out the time as expected.
Here are my questions
Is x a pointer to the list in alarms or is it a separate copy of the internal list? In other words, can I change the value in x[1] and will that result in a change in the larger alarms list?
do the json.dump and json.load functions work well with dictionaries? I need to be able to write the alarms out to an output file so that after a reboot, the correct alarms rooms and times can be reloaded.