[Python]查看当前时间

1 >>> import datetime
2 >>> datetime.datetime.now()
3 datetime.datetime(2021, 4, 7, 10, 5, 34, 431884)
4 >>> ISOTIMEFORMAT = '%Y-%m-%d %H:%M:%S,%f'
5 >>> theTime = datetime.datetime.now().strftime(ISOTIMEFORMAT)
6 >>> theTime
7 '2021-04-07 10:06:59,190904'
原文地址:https://www.cnblogs.com/LeeCookies/p/14630867.html