I am a beginner in python. What I want to do is to make a log file readable.
For now what I have is a way to read and write a file..
For parsing the log line I use this code:
if 'EXAMPLE LINE IN LOG FILE WITH extra info tag=on' in line:
output_file.write(datestring + " Device was turned on" + "\n")
Not very pythonic but it works for me.
Now what I want to do is write Divices was turned off if the line in the log says tag=off.
I can simply copy the code again like this:
if 'EXAMPLE LINE IN LOG FILE WITH extra info tag=off' in line:
output_file.write(datestring + " Device was turned off" + "\n")
But that is not very nice and it is more easy editing in the future.
Can someone help my on my way?