Login and get coding
In this bite we will look at this small server log finding the first and last system shutdown events:INFO 2014-07-03T23:27:51 supybot Shutdown initiated. ... INFO 2014-07-03T23:31:22 supybot Shutdown initiated.
You need to calculate the time between these two events. First extract the timestamps from the log entries and convert them to
datetimeobjects. Then use
datetime.timedeltato calculate the time difference between them.
You can assume the logs are sorted in ascending order. Check out the docstrings and the TESTS for more info.
Good luck and keep calm and code in Python!