Running a .py file iteratively at the terminal

Mark Lawrence breamoreboy at yahoo.co.uk
Mon Jan 26 21:30:42 CET 2015


On 26/01/2015 19:52, varun7rs at gmail.com wrote:
> Hello Everyone,
>
> I am running a python script as of now and I have to change three global values repeatedly. I'm tired of doing this manually. SO, I was wondering if there is a way to run a python command repeatedly. In my case, the command would be
>
> srva at hades:~$ python NFV_v3_7_10_14.py -l log --lp --xml eu_v3_14_1_15.xml
>
> Everytime I run this, I get a log file with the results. The main file is the NFV_v3....py. These are the values I intend to change iteratively and then run the command in the terminal.
> dataplane_latencybound = 200 # The delay bounds are in milli seconds
> controlplane_latencybound1 = 200 # The delay bounds are in milli seconds
>
> So, in every iteration, I would like to increase it from 0 in steps of 10 till 200. And after doing so, I'd like to run the command. But, I'm unaware of doing this using a single script. I hope some of you experts over there could help me in this issue. It can be a huge timesaver.
>
>
> Thanks a lot guys
> Varun RS
>

I think you need this:-

dataplane_latencybound in range(0, 205, 10):
     doSomething(dataplane_latencybound)

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence




More information about the Python-list mailing list