how to count time in python code example

Example 1: python print time

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

Example 2: how calculate time in python

import time
start = time.process_time()
# your code here    
print(time.process_time() - start)

Example 3: How to check how much time elapsed Python

import time
t0= time.clock()
print("Hello")
t1 = time.clock() - t0
print("Time elapsed: ", t1) # CPU seconds elapsed (floating point)

Example 4: time in python

import time
thistime = time.time()
# Here's an idea!
def CountTime():
  while(True):
    time.sleep(1)
    print(thistime)
CountTime()