Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.
One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.
import os, time from datetime import datetime, timedelta def SpecErrLog(File, dt, err, Duration): source_file = open(File,"r") try: file1 = File + " " + dt.replace(":","_") + " [" + err + "]" + str(Duration) #file1 = "temptry.txt" dest_file = open(file1, 'w') Mach, Dt = File.split() BeginDay = datetime.strptime("00:00:00.000", '%H:%M:%S.%f') EndDay = datetime.strptime("23:59:59.999", '%H:%M:%S.%f') dt = datetime.strptime(dt, '%H:%M:%S.%f') for line in source_file: arr=line.split(",") LineTimeStamp = datetime.strptime(arr.strip(), '%H:%M:%S.%f') #timeStamp of sourcefile. upperLimit= dt + timedelta(minutes=Duration) lowerLimit= dt - timedelta(minutes=Duration) if lowerLimit > BeginDay and upperLimit < EndDay: #if all records accurr within the same day. if lowerLimit < LineTimeStamp < upperLimit: dest_file.write(line) finally: source_file.close dest_file.close print "finished" if __name__ == "__main__": dt = "09:52:15.710" err = "54300" SpecErrLog("H108 01-24-2011", dt, err, 30)
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
|How to get only tweeted data from the output file||3||109|
|Error catching in Python||8||57|
|Need a python script||5||100|
|cannot use pip to install pandas or pandas_datareader||5||240|