Generate current time in Python

Python

Import modules

import datetime

Grab current datetime

datetime.datetime.now()
datetime.datetime(2017, 9, 7, 15, 6, 49, 819248)

Grab current time

datetime.datetime.now().time()
datetime.time(15, 8, 51, 723898)

Grab datetime in more readable format

str(datetime.datetime.now())
'2017-09-07 15:06:50.211892'