0
Q:

how to make python tell the time

import datetime
now = datetime.datetime.now()
print (now.strftime("%Y-%m-%d %H:%M:%S"))
# key: https://strftime.org/
16

from datetime import datetime

now = datetime.now()

current_time = now.strftime("%H:%M:%S")
print("Current Time =", current_time)
5

import time

t = time.localtime()
current_time = time.strftime("%H:%M:%S", t)
print(current_time)
2

New to Communities?

Join the community