postRui.py
703 Bytes
import re
from datetime import datetime
f = open("tmp000_out.txt","r")
lines = f.readlines()
# OFFSET = datetime(2000,1,1,12) - datetime(1970,1,1) == 10957 days, 12:00:00
OFFSET = 946684800 + 12 * 3600
# datetime.utcfromtimestamp(559889620.293) + OFFSET
# datetime.datetime(2017, 9, 28, 16, 53, 40, 293000)
filename = "outputsAll.txt"
with open(filename, "w") as myFile:
for i in range(len(lines)):
x = lines[i].strip()
y = re.sub(' +', ' ',x).split(' ')
time = datetime.utcfromtimestamp(int((float(y[0]))) + OFFSET).isoformat()
newline = [time,y[1],y[2],y[3],y[4],y[5],y[6],y[7],y[8],y[9],y[10],y[11]]
myFile.write(' '.join(newline)+'\n')
myFile.close()
f.close()