Skip to content
Advertisement

Python dynamic for loop range size

I’m trying to add Link argument to ini file by using python. Example of ini file:

JavaScript

I need to do like this:

JavaScript

My for loop:

JavaScript

My code works, but it does not add Link for last tags. I’ve found why. If I add in range(len(m)+100): Then code adds all Links.

Looks like len(m) is old value (static?), because I’m increasing len with insert during loop. Any ideas?

I have tried something like insertings = 0, then range(len(m)+insertings) and afer insert insertings = insertings+1 But no luck :(

Advertisement

Answer

Create a new list:

JavaScript
Advertisement