How to obtain timings from a specific line in a text file and subtract it with another line in python?

I have a text file in which certain data like this

2t05sj7jh36pl7qti1e5n9j6j0-poll-4|10/06/2015 05:32:09 pm

Is stored. The 2t05sj7jh36pl7qti1e5n9j6j0 is the UID and the poll-4 is the key as you can see there is a time. Another piece of data would be

2t05sj7jh36pl7qti1e5n9j6j0-load-5|10/06/2015 05:32:22 pm 

as you can see the key is load-5 but the UID is the same. The text file is filled with these and what I need to be able to do is calculate the poll time difference from the load time and make sure that the poll and the load are from the same UID.Keeping in mind its from a text file.

Source: linux

Leave a Reply