I have the following python code:
raw_list = reminders_context['data']['reminder_list']
This statement works fine and gets the required info that I want.
The following code gives me the error list index out of range but the inner workings of the for loop for eg.[I obviously substitute the 'i' value for a number, then get the first 10 characters of the list item with [:10]], work fine when I set a trace in pdb mode.
raw_list[i]['created'][:10] == raw_list[i + 1]['created'][:10]
Code that gives an error:
for i in range(len(raw_list)):
if raw_list[i]['created'][:10] == raw_list[i + 1]['created'][:10]:
del raw_list[i + 1]
else:
pass
How can I change it so that I do not get the error?
I have seen something about how my list gets reduced in the for loop when iterating but I simply do not know how to implement it in my code.
The article I'm referring to is here: