【发布时间】:2019-04-09 11:25:28
【问题描述】:
我想为本地机器打印当前日期和时间以及时区名称。但是,我似乎无法得到最后一点
In [1]: from datetime import datetime
In [2]: print(datetime.now().strftime('%d %b %Y %H:%M:%S'))
09 Apr 2019 13:23:47
In [3]: print(datetime.now().strftime('%d %b %Y %H:%M:%S %Z'))
09 Apr 2019 13:23:52
我本来希望看到我的 PC 的时区名称 ('CET') 添加到第二个字符串中。我如何获得:
09 Apr 2019 13:23:52 CET
【问题讨论】: