I am new to python and I'm trying to save the output of last boot time of a machine in csv format. It should come as "Date" in one column and "Time" in another column. Below is the simple python code but it is not working out. Can you help on this
import psutil,datetime
import json
import csv
psutil.boot_time()
with open(r'path') as f:
data=json.load(f)
b = datetime.datetime.fromtimestamp(psutil.boot_time()).strftime("%Y-%m-%d %H:%M:%S")
print(b)
with open("uptime.csv", "wb") as f:
writer=csv.writer(f)