Get time zone information of the system in Python?

前端 未结 8 1136
情歌与酒
情歌与酒 2020-12-02 11:40

I want to get the default timezone (PST) of my system from Python. What\'s the best way to do that? I\'d like to avoid forking another process.

8条回答
  •  广开言路
    2020-12-02 12:35

    Check out the Python Time Module.

    from time import gmtime, strftime
    print(strftime("%z", gmtime()))
    

    Pacific Standard Time

提交回复
热议问题