📜  如何在python代码示例中获取系统时间

📅  最后修改于: 2022-03-11 14:45:07.330000             🧑  作者: Mango

代码示例2
---------------------------------------------------------
import datetime
 
currentDateTime = datetime.datetime.now()
print(currentDateTime)
---------------------------------------------------------
OR
---------------------------------------------------------
from datetime import datetime
 
currentDateTime = datetime.now()
print(currentDateTime)
---------------------------------------------------------
OR
---------------------------------------------------------
import datetime

print(datetime.datetime.now())
---------------------------------------------------------
OR
---------------------------------------------------------
from datetime import datetime
 
print(datetime.now())
---------------------------------------------------------