Hi,
I am a little newbie with python, more use of C++
The goal is to search a specifed filename e trought multiple directories.
After finding the file, search trough it's content some description on some strings and write out the description on a xml file.
So far i manage to search trough a file a single line that is in the same directory with script, but this isn't the goal, just a starting point.
The content of one control.ini - the searched file file looks like this:
[INFO]
name = ping
description = '''This test runs the ping utility to test the connectivity
between target and server hosts with the folowing IP addres: 192.169.0.4.
'''
timeout = 300
version1
search file trought directories, search content of file, copy content to a file
and my code so far is:
import os , os.path
r = open('/home/test/control.ini', 'r')
w = open('/home/test/result.txt' , 'w')
for line in r.readlines():
if "description" in line :
x= str(line)
print x
r.closed
w.write(x)
w.closed
Maybe i wold like to put the name, version and timeout later out.
The field description, version, name and timeout is the same in all controls.ini.
Any suggestion is much aprecieted.
Thanks!