tests/seq.py
branchstable
changeset 24803 e89f909edffa
parent 24360 f554f89a2038
child 28721 ff3be5a325bc
equal deleted inserted replaced
24753:612ed41ae359 24803:e89f909edffa
       
     1 #!/usr/bin/env python
       
     2 #
       
     3 # A portable replacement for 'seq'
       
     4 #
       
     5 # Usage:
       
     6 #   seq STOP              [1, STOP] stepping by 1
       
     7 #   seq START STOP        [START, STOP] stepping by 1
       
     8 #   seq START STEP STOP   [START, STOP] stepping by STEP
       
     9 
       
    10 import sys
       
    11 
       
    12 start = 1
       
    13 if len(sys.argv) > 2:
       
    14     start = int(sys.argv[1])
       
    15 
       
    16 step = 1
       
    17 if len(sys.argv) > 3:
       
    18     step = int(sys.argv[2])
       
    19 
       
    20 stop = int(sys.argv[-1]) + 1
       
    21 
       
    22 for i in xrange(start, stop, step):
       
    23     print i