python datetime import datetime nowtime = datetime.datetime.now() nowtime.strftime("%Y-%m-%d %H:%M:%S.") + str(nowtime.microsecond)