I'm currently working on a log script with time,value entries.
I use the script as follows:
./parsy.py < log
and in the script I loop over the lines with
for line in sys.stdin:
Is there an easy way to check if the current line is the last one of the input, because I have the save the time of this line as the total time the log ran.
I could update this total time every line, but that's not that efficient...
Thanks in advance
If extracting the time is as expensive as you say, you could do something like:
line = None
for line in sys.stdin:
# ...
if line is not None:
# `line' contains the last line; extract the time etc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With