1# Here is a self updating clock function, just run it and it'll self update itself until you hit CTRL-C
2import datetime
3import time
4def clock():
5 while True:
6 print(datetime.datetime.now().strftime("%H:%M:%S"), end="\r")
7 time.sleep(1)
8
9clock()
1import time
2seconds = time.time()
3print("Seconds since epoch =", seconds)
4
1import time
2
3# seconds passed since epoch
4seconds = 1545925769.9618232
5local_time = time.ctime(seconds)
6print("Local time:", local_time)
7