shangsunset shangsunset - 1 year ago 100
C++ Question

how to control increments with a variable in python for loop

Here is a for loop in

, how can I achieve the same in with
loop in Python? Incrementing

for (int i = 0; i < some_string.size();) {

int k = i;
while (some_condition) ++k;
i = k+1;
// ....


Answer Source

The following lines of code do the same thing as c++ code in question; however, I don't know if this is the goal you want to achieve:

i = 0
while i < len(some_string):
    k = i
    while some_condition:
        k += 1
    i = k + 1
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download