Suggested datatype for getting latest information from log files

ltomassmail at gmail.com ltomassmail at gmail.com
Thu Feb 11 13:07:21 EST 2016


I have timestamped  log files I need to read through and keep track of the most upto date information.

For example lets say we had a log file

timeStamp,name,marblesHeld,timeNow,timeSinceLastEaten

I need to keep track of every 'name' in this table, I don't want duplicate values so if values come in from a later timestamp that is different then that needs to get updated. For example if a later timestamp showed 'dave' with less marbles that should get updated.

I thought a dictionary would be a good idea because of the key restrictions ensuring no duplicates, so the data would always update - However because they are unordered and I need to do some more processing on the data afterwards I'm having trouble.

For example lets assume that once I have the most upto date values from dave,steve,jenny I wanted to do timeNow - timeSinceLastEaten to get an interval then write all the info together to some other database. Crucially order is important here.

I don't know of a particular name will appear in the records or not, so it needs to created on the first instance and updated from then on.

Could anyone suggest some good approaches or suggested data structures for this?

I thought about trying to create an object for each 'name' then check if that object exists and update values within that object. However that seemed like
a. overkill
b. beyond my Python skills for the timeframe I have


More information about the Python-list mailing list