-
“I can now use it normally.”
-
When I explained the problem and asked why this was happening, they explained it to me in a normal way (blu3mo).
-
The second code seems to be removing all the pages that contain the word “private.icon” because it is looping through the pages repeatedly until there are no more pages that contain the word “private.icon”.
-
The issue with the first code is that it modifies the list it is iterating over (data‘pages’) while iterating over it. When an item is removed from the list, the indices of the remaining items shift down by one, which can cause some pages to be skipped or processed multiple times.
-
In contrast, the second code continues looping through the pages until all the pages that contain “private.icon” are removed from the list. The loop stops when there are no more pages with the word “private.icon” left in the list, and all the pages that need to be removed have been removed. This approach avoids the issue of modifying a list while iterating over it.
- I probably would have taken more time to debug this on my own (blu3mo).
-