from datetime import datetime
now = datetime.now() # 获取当前时间的datetime对象
now_seconds = round(now.timestamp())
# now.timestamp()会返回带毫秒的浮点数:1782868575.267624,比如:now.timestamp()(秒)
now_str = now.strftime("%Y-%m-%d %H:%M:%S")
print(now_str)
from datetime import datetime
now = datetime.now() # 获取当前时间的datetime对象
now_seconds = round(now.timestamp())
# now.timestamp()会返回带毫秒的浮点数:1782868575.267624,比如:now.timestamp()(秒)
now_str = now.strftime("%Y-%m-%d %H:%M:%S")
print(now_str)
352

被折叠的 条评论
为什么被折叠?
