How to print time in python?

We can get the time by importing a library datetime.
from datetime import datetime t=datetime.now() current=t.strftime("%h:%m:%s") print(current)

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

This is how we can print time in python.
Subscribe
Login
Please login to comment
0 Discussion