Answers for "how to read time in python"

3

how to print time python

import datetime
datetime.datetime.now()
datetime.datetime(2009, 1, 6, 15, 8, 24, 78915)

print(datetime.datetime.now())
#2009-01-06 15:08:24.789150
Posted by: Guest on June-02-2020
2

python clock

# Here is a self updating clock function, just run it and it'll self update itself until you hit CTRL-C
import datetime
import time
def clock():
    while True:
        print(datetime.datetime.now().strftime("%H:%M:%S"), end="r")
        time.sleep(1)

clock()
Posted by: Guest on July-23-2020
21

python time library

#also see datetime
import time
now = time.time()
print(now)
Posted by: Guest on February-21-2020

Code answers related to "how to read time in python"

Python Answers by Framework

Browse Popular Code Answers by Language