Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Find min and max time of an operation from a log file
- __author__ = 'gauravssnl'
- file ='c:\\logfile.txt'
- f = open(file)
- operation_time_dict = { }
- for data in f :
- data = data.strip( )
- data_list = data.split( ',' )
- key = data_list[0]
- val = data_list[1]
- if operation_time_dict.has_key( key ) is False :
- operation_time_dict[ key] = [ val ]
- else :
- (operation_time_dict[ key ] ).append(val)
- operation_list = operation_time_dict.keys()
- operation_list.sort()
- for key in operation_list :
- print('%s , %s , %s' %( key , min( operation_time_dict[ key ]) , max( operation_time_dict[ key ] ) ) )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement