title: Python: is there a C-like for loop available?
body: <p>Can I do something like this in Python?</p>
  
  <pre><code>for (i = 0; i &lt; 10; i++):
    if someCondition:
       i+=1
    print i
  </code></pre>
  
  <p>I need to be able to skip some values based on a condition</p>
  
  <p>EDIT: All the solutions so far suggest pruning the initial range in one way or another, based on an already known condition. This is not useful for me, so let me explain what I want to do.</p>
  
  <p>I want to manually (i.e. no getopt) parse some cmd line args, where each 'keyword' has a certain number of parameters, something like this:</p>
  
  <pre><code>for i in range(0,len(argv)):
      arg = argv[i]
      if arg == '--flag1':
         opt1 = argv[i+1]
         i+=1
         continue
      if arg == '--anotherFlag':
         optX = argv[i+1]
         optY = argv[i+2]
         optZ = argv[i+3]
         i+=3
         continue
  
      ...
  </code></pre>