• <legend id='3Xis3'><style id='3Xis3'><dir id='3Xis3'><q id='3Xis3'></q></dir></style></legend>
    • <bdo id='3Xis3'></bdo><ul id='3Xis3'></ul>

    1. <i id='3Xis3'><tr id='3Xis3'><dt id='3Xis3'><q id='3Xis3'><span id='3Xis3'><b id='3Xis3'><form id='3Xis3'><ins id='3Xis3'></ins><ul id='3Xis3'></ul><sub id='3Xis3'></sub></form><legend id='3Xis3'></legend><bdo id='3Xis3'><pre id='3Xis3'><center id='3Xis3'></center></pre></bdo></b><th id='3Xis3'></th></span></q></dt></tr></i><div id='3Xis3'><tfoot id='3Xis3'></tfoot><dl id='3Xis3'><fieldset id='3Xis3'></fieldset></dl></div>

      <small id='3Xis3'></small><noframes id='3Xis3'>

      1. <tfoot id='3Xis3'></tfoot>

        如何获取与当前时区对应的 tz_info 对象?

        how to get tz_info object corresponding to current timezone?(如何获取与当前时区对应的 tz_info 对象?)
          <tbody id='zMPyU'></tbody>
        • <tfoot id='zMPyU'></tfoot>

          <small id='zMPyU'></small><noframes id='zMPyU'>

                <legend id='zMPyU'><style id='zMPyU'><dir id='zMPyU'><q id='zMPyU'></q></dir></style></legend>
                <i id='zMPyU'><tr id='zMPyU'><dt id='zMPyU'><q id='zMPyU'><span id='zMPyU'><b id='zMPyU'><form id='zMPyU'><ins id='zMPyU'></ins><ul id='zMPyU'></ul><sub id='zMPyU'></sub></form><legend id='zMPyU'></legend><bdo id='zMPyU'><pre id='zMPyU'><center id='zMPyU'></center></pre></bdo></b><th id='zMPyU'></th></span></q></dt></tr></i><div id='zMPyU'><tfoot id='zMPyU'></tfoot><dl id='zMPyU'><fieldset id='zMPyU'></fieldset></dl></div>
                • <bdo id='zMPyU'></bdo><ul id='zMPyU'></ul>

                  本文介绍了如何获取与当前时区对应的 tz_info 对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  python(或pytz)中是否有一个跨平台函数,它返回一个与当前设置的时区对应的tzinfo对象电脑?

                  Is there a cross-platform function in python (or pytz) that returns a tzinfo object corresponding to the timezone currently set on the computer?

                  环境变量不能依赖,因为它们不是跨平台的

                  environment variables cannot be counted on as they are not cross-platform

                  推荐答案

                  >>> import datetime
                  >>> today = datetime.datetime.now()
                  >>> insummer = datetime.datetime(2009,8,15,10,0,0)
                  >>> from pytz import reference
                  >>> localtime = reference.LocalTimezone()
                  >>> localtime.tzname(today)
                  'PST'
                  >>> localtime.tzname(insummer)
                  'PDT'
                  >>> 
                  

                  这篇关于如何获取与当前时区对应的 tz_info 对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  env: python: No such file or directory(env: python: 没有这样的文件或目录)
                  How to evaluate environment variables into a string in Python?(如何在 Python 中将环境变量评估为字符串?)
                  Python - temporarily modify the current process#39;s environment(Python - 临时修改当前进程的环境)
                  Change current process environment#39;s LD_LIBRARY_PATH(更改当前进程环境的 LD_LIBRARY_PATH)
                  Reading and writing environment variables in Python?(在 Python 中读写环境变量?)
                  When to use sys.path.append and when modifying %PYTHONPATH% is enough(何时使用 sys.path.append 以及何时修改 %PYTHONPATH% 就足够了)
                • <small id='Xwiiq'></small><noframes id='Xwiiq'>

                  • <bdo id='Xwiiq'></bdo><ul id='Xwiiq'></ul>
                    <tfoot id='Xwiiq'></tfoot>
                      <tbody id='Xwiiq'></tbody>

                        <legend id='Xwiiq'><style id='Xwiiq'><dir id='Xwiiq'><q id='Xwiiq'></q></dir></style></legend>
                          <i id='Xwiiq'><tr id='Xwiiq'><dt id='Xwiiq'><q id='Xwiiq'><span id='Xwiiq'><b id='Xwiiq'><form id='Xwiiq'><ins id='Xwiiq'></ins><ul id='Xwiiq'></ul><sub id='Xwiiq'></sub></form><legend id='Xwiiq'></legend><bdo id='Xwiiq'><pre id='Xwiiq'><center id='Xwiiq'></center></pre></bdo></b><th id='Xwiiq'></th></span></q></dt></tr></i><div id='Xwiiq'><tfoot id='Xwiiq'></tfoot><dl id='Xwiiq'><fieldset id='Xwiiq'></fieldset></dl></div>