<br>
I needed a script that takes command line arguments, searches an ini
file for a match to the arguments and then executes a Windows
executable. This is my first script using python so I wanted to make
sure I made
the most of the language. I took bits and pieces from different
tutorials and examples online. The script is executed in this manner:<br>
<br>
<br>
<div style="margin-left: 40px;">python search_interface.py device interface interface_name &quot;is down - 00:00:00 01/01/06&quot;<br>
</div>
<br>
<br>
Here is the script:<br>
<br>
<div style="margin-left: 40px;">
import ConfigParser, string, sys<br>

section = sys.argv[1]<br>

port = sys.argv[3]<br>

INI=ConfigParser.ConfigParser()<br>

INI.read(&quot;interfaces.ini&quot;)<br>

passwordentries=[p for p in INI.options(section)]<br>

passwordlist=[INI.get(section, pw) for pw in passwordentries]<br>

print passwordlist<br>

for i in passwordlist:<br>

&nbsp;&nbsp; &nbsp;if i == port:<br>

&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;os.system(&quot;d:\\tnd\\bin\\cawto.exe -cat NetNet &quot; + sys.argv[1] +
&quot; &quot; + sys.argv[2] + &quot; &quot; + sys.argv[3] + &quot; &quot; + sys.argv[4])<br>
</div>
<br>
<br>
I'd like to know if there is a more efficient way to do this and if
there is a way to have these functions performed with the least amount
of time possible (the ini file could grow quite large).<br>
<br>
<br>
<br>
Thanks!!<br>