• <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 对象?

        时间:2023-07-04
          <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 对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:确定当天的开始和结束时间(UTC -> EST -> UTC);Python 下一篇:Python REST(Web 服务)框架的推荐?

                  相关文章

                • <small id='Xwiiq'></small><noframes id='Xwiiq'>

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

                  1. <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>